1
|
# this file derive from django-tenant-schemas
|
2
|
# Author: Bernardo Pires Carneiro
|
3
|
# Email: carneiro.be@gmail.com
|
4
|
# License: MIT license
|
5
|
# Home-page: http://github.com/bcarneiro/django-tenant-schemas
|
6
|
from django.conf import settings
|
7
|
from django.core.management.base import CommandError, BaseCommand
|
8
|
try:
|
9
|
from south.management.commands.migrate import Command as MigrateCommand
|
10
|
except ImportError:
|
11
|
MigrateCommand = BaseCommand
|
12
|
|
13
|
|
14
|
class Command(MigrateCommand):
|
15
|
|
16
|
def handle(self, *args, **options):
|
17
|
database = options.get('database', 'default')
|
18
|
if (settings.DATABASES[database]['ENGINE'] == 'tenant_schemas.postgresql_backend' or
|
19
|
MigrateCommand is BaseCommand):
|
20
|
raise CommandError("migrate has been disabled, for database '{}'. Use migrate_schemas "
|
21
|
"instead. Please read the documentation if you don't know why you "
|
22
|
"shouldn't call migrate directly!".format(database))
|
23
|
super(Command, self).handle(*args, **options)
|