mirror of
https://github.com/carrotquest/django-clickhouse.git
synced 2025-06-02 04:03:13 +03:00
set default database for non model migrations
This commit is contained in:
parent
06f5929c92
commit
5bcd9cc0b1
|
@ -1,4 +1,5 @@
|
||||||
from infi import clickhouse_orm
|
from infi import clickhouse_orm
|
||||||
|
from .configuration import config
|
||||||
|
|
||||||
|
|
||||||
class HintParamMixin:
|
class HintParamMixin:
|
||||||
|
@ -7,6 +8,12 @@ class HintParamMixin:
|
||||||
hints = dict()
|
hints = dict()
|
||||||
self.hints = hints
|
self.hints = hints
|
||||||
super(HintParamMixin, self).__init__(*args, **kwargs)
|
super(HintParamMixin, self).__init__(*args, **kwargs)
|
||||||
|
if not any([
|
||||||
|
isinstance(self, clickhouse_orm.ModelOperation),
|
||||||
|
'model' not in hints.keys(),
|
||||||
|
'force_migrate_on_databases' not in hints.keys()
|
||||||
|
]):
|
||||||
|
self.hints['force_migrate_on_databases'] = (config.DEFAULT_DB_ALIAS,)
|
||||||
|
|
||||||
|
|
||||||
class CreateTable(HintParamMixin, clickhouse_orm.CreateTable):
|
class CreateTable(HintParamMixin, clickhouse_orm.CreateTable):
|
||||||
|
|
Loading…
Reference in New Issue
Block a user