From cb6c329d32f571936bd34881710ea11efb4e5014 Mon Sep 17 00:00:00 2001 From: Itai Shirav Date: Mon, 26 Jun 2017 11:09:57 +0300 Subject: [PATCH 1/2] Migrations: when creating a table for a `BufferModel`, create the underlying table too if necessary --- CHANGELOG.md | 4 ++++ buildout.cfg | 1 + src/infi/clickhouse_orm/migrations.py | 4 +++- 3 files changed, 8 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 02795f2..421955a 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,6 +1,10 @@ Change Log ========== +Unreleased +---------- +- Migrations: when creating a table for a `BufferModel`, create the underlying table too if necessary + v0.9.3 ------ - Changed license from PSF to BSD diff --git a/buildout.cfg b/buildout.cfg index a8c2fec..004a6fd 100644 --- a/buildout.cfg +++ b/buildout.cfg @@ -17,6 +17,7 @@ install_requires = [ ] version_file = src/infi/clickhouse_orm/__version__.py description = A Python library for working with the ClickHouse database +long_description = A Python library for working with the ClickHouse database console_scripts = [] gui_scripts = [] package_data = [] diff --git a/src/infi/clickhouse_orm/migrations.py b/src/infi/clickhouse_orm/migrations.py index 8167a20..ebcbacc 100644 --- a/src/infi/clickhouse_orm/migrations.py +++ b/src/infi/clickhouse_orm/migrations.py @@ -1,4 +1,4 @@ -from .models import Model +from .models import Model, BufferModel from .fields import DateField, StringField from .engines import MergeTree from .utils import escape @@ -28,6 +28,8 @@ class CreateTable(Operation): def apply(self, database): logger.info(' Create table %s', self.model_class.table_name()) + if issubclass(self.model_class, BufferModel): + database.create_table(self.model_class.engine.main_model) database.create_table(self.model_class) From a2acb9a025c3205df4b490a1f46d73eec4e7a2fc Mon Sep 17 00:00:00 2001 From: Itai Shirav Date: Mon, 26 Jun 2017 11:10:18 +0300 Subject: [PATCH 2/2] Releasing v0.9.4 --- CHANGELOG.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 421955a..f875d12 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,8 +1,8 @@ Change Log ========== -Unreleased ----------- +v0.9.4 +------ - Migrations: when creating a table for a `BufferModel`, create the underlying table too if necessary v0.9.3