Révision 1f642209
Ajouté par Thomas Noël il y a plus de 9 ans
entrouvert/djommon/multitenant/management/commands/safemigrate_schemas.py | ||
---|---|---|
3 | 3 |
# Email: carneiro.be@gmail.com |
4 | 4 |
# License: MIT license |
5 | 5 |
# Home-page: http://github.com/bcarneiro/django-tenant-schemas |
6 |
from django.conf import settings |
|
7 |
from django.db import connection |
|
8 |
from south import migration |
|
9 |
from south.migration.base import Migrations |
|
10 |
from entrouvert.djommon.multitenant.middleware import TenantMiddleware |
|
6 |
import django |
|
7 |
|
|
8 |
if django.VERSION < (1, 7, 0): |
|
9 |
from django.conf import settings |
|
10 |
from django.db import connection |
|
11 |
from south import migration |
|
12 |
from south.migration.base import Migrations |
|
13 |
from entrouvert.djommon.multitenant.middleware import TenantMiddleware |
|
14 |
from entrouvert.djommon.management.commands.safemigrate import Command as SafeMigrateCommand |
|
15 |
from entrouvert.djommon.multitenant.management.commands.sync_schemas import Command as MTSyncCommand |
|
16 |
from entrouvert.djommon.multitenant.management.commands.migrate_schemas import Command as MTMigrateCommand |
|
11 | 17 |
from entrouvert.djommon.multitenant.management.commands import SyncCommon |
12 |
from entrouvert.djommon.management.commands.safemigrate import Command as SafeMigrateCommand |
|
13 |
from entrouvert.djommon.multitenant.management.commands.sync_schemas import Command as MTSyncCommand |
|
14 |
from entrouvert.djommon.multitenant.management.commands.migrate_schemas import Command as MTMigrateCommand |
|
15 | 18 |
|
16 | 19 |
|
17 |
class Command(SyncCommon): |
|
20 |
class SafeMigrateCommand(SyncCommon):
|
|
18 | 21 |
help = "Safely migrate schemas with South" |
19 | 22 |
option_list = MTMigrateCommand.option_list |
20 | 23 |
|
... | ... | |
95 | 98 |
|
96 | 99 |
self._clear_south_cache() |
97 | 100 |
self._restore_south_settings() |
101 |
|
|
102 |
if django.VERSION < (1, 7, 0): |
|
103 |
Command = SafeMigrateCommand |
|
104 |
else: |
|
105 |
raise RuntimeError('Django 1.7: please use migrate_schemas') |
Formats disponibles : Unified diff
migrate_schemas: use django 1.7 if available (#6388)