# -*- coding: utf-8 -*- # # This file is part of Django appschema released under the MIT license. # See the LICENSE for more information. from django.conf import settings from django.core.management.base import BaseCommand, CommandError from south.db import DEFAULT_DB_ALIAS import appschema migrate = appschema.migrate() from appschema.db import migrate_apps from appschema.models import Schema from appschema.south_utils import get_migration_candidates from appschema.utils import get_apps, load_post_syncdb_signals class Command(BaseCommand): option_list = migrate.Command.option_list help = migrate.Command.help args = migrate.Command.args def handle(self, app=None, target=None, skip=False, merge=False, backwards=False, fake=False, db_dry_run=False, show_list=False, database=DEFAULT_DB_ALIAS, delete_ghosts=False, ignore_ghosts=False, **options): if not 'south' in settings.INSTALLED_APPS: raise CommandError('South is not installed.') verbosity = int(options.get('verbosity', 0))
# -*- coding: utf-8 -*- # # This file is part of Django appschema released under the MIT license. # See the LICENSE for more information. from django import db from appschema import syncdb, migrate syncdb = syncdb() migrate = migrate() from appschema.schema import schema_store from appschema.utils import get_apps, load_post_syncdb_signals, run_with_apps def syncdb_apps(apps, schema=None, **options): """ This function simply call syncdb command (Django or South one) for select apps only. """ def wrapper(_apps, *args, **kwargs): load_post_syncdb_signals() return syncdb.Command().execute(**kwargs) # Syncdb without schema (on public) if not schema: schema_store.reset_path() return run_with_apps(apps, wrapper, **options) # Syncdb with schema # # We first handle the case of apps that are both shared and isolated.