def _upgrade(interactive, traceback, verbosity, repair, with_nodestore): from django.core.management import call_command as dj_call_command _check_history() for db_conn in settings.DATABASES.keys(): # Always run migrations for the default connection. # Also run migrations on connections that have migrations explicitly enabled. # This is used for sentry.io as our production database runs on multiple hosts. if db_conn == "default" or settings.DATABASES[db_conn].get( "RUN_MIGRATIONS", False): click.echo(f"Running migrations for {db_conn}") dj_call_command( "migrate", database=db_conn, interactive=interactive, traceback=traceback, verbosity=verbosity, ) if with_nodestore: from sentry import nodestore nodestore.bootstrap() if repair: from sentry.runner import call_command call_command("sentry.runner.commands.repair.repair")
def _upgrade(interactive, traceback, verbosity, repair, with_nodestore): from django.core.management import call_command as dj_call_command # migrate legacy south history into new django migrations automatically _migrate_from_south(verbosity) dj_call_command( "migrate", interactive=interactive, traceback=traceback, verbosity=verbosity, migrate=True, merge=True, ignore_ghost_migrations=True, ) if with_nodestore: from sentry import nodestore nodestore.bootstrap() if repair: from sentry.runner import call_command call_command("sentry.runner.commands.repair.repair")
def _upgrade(interactive, traceback, verbosity, repair): from django.core.management import call_command as dj_call_command if 'south' in settings.INSTALLED_APPS or DJANGO_17: dj_call_command( 'migrate', interactive=interactive, traceback=traceback, verbosity=verbosity, migrate=True, merge=True, ignore_ghost_migrations=True, ) else: dj_call_command( 'syncdb', interactive=interactive, traceback=traceback, verbosity=verbosity, ) if repair: from sentry.runner import call_command call_command( 'sentry.runner.commands.repair.repair', )
def call_command(self, *args, **kwargs): stdout = StringIO() try: kwargs['stdout'] = stdout dj_call_command(*args, **kwargs) except SystemExit as err: return err.code, stdout.getvalue() self.fail("ingest script should always throw a systemexit()")
def migrate(): click.secho('Applying database migrations:', fg='green') dj_call_command( 'migrate', interactive=False, verbosity=1, )
def handle(self, *args, **options): # 创建一个oauth provider application 给logagent # 更新实例数据表 print('upgrade db ...') # dj_call_command('syncdb') dj_call_command( 'migrate', merge=True, ignore_ghost_migrations=True)
def _upgrade(interactive, traceback, verbosity, repair): from django.core.management import call_command as dj_call_command from clims.services import ioc dj_call_command( 'migrate', interactive=interactive, traceback=traceback, verbosity=verbosity, migrate=True, merge=True, ignore_ghost_migrations=True, ) if repair: from sentry.runner import call_command call_command('sentry.runner.commands.repair.repair', ) ioc.app.plugins.auto_install()
def upgrade(ctx, verbosity, traceback, noinput): "Perform any pending database migrations and upgrades." from django.core.management import call_command as dj_call_command dj_call_command("syncdb", interactive=not noinput, traceback=traceback, verbosity=verbosity) dj_call_command( "migrate", merge=True, ignore_ghost_migrations=True, interactive=not noinput, traceback=traceback, verbosity=verbosity, ) from sentry.runner import call_command call_command("sentry.runner.commands.repair.repair")
def upgrade(ctx, verbosity, traceback, noinput): "Perform any pending database migrations and upgrades." from django.core.management import call_command as dj_call_command dj_call_command( 'syncdb', interactive=not noinput, traceback=traceback, verbosity=verbosity, ) dj_call_command( 'migrate', merge=True, ignore_ghost_migrations=True, interactive=not noinput, traceback=traceback, verbosity=verbosity, )
def _upgrade(interactive, traceback, verbosity): from django.core.management import call_command as dj_call_command dj_call_command( 'syncdb', interactive=interactive, traceback=traceback, verbosity=verbosity, ) dj_call_command( 'migrate', merge=True, ignore_ghost_migrations=True, interactive=interactive, traceback=traceback, verbosity=verbosity, ) from sentry.runner import call_command call_command('sentry.runner.commands.repair.repair', )
def _upgrade(interactive, traceback, verbosity): from django.core.management import call_command as dj_call_command dj_call_command( 'syncdb', interactive=interactive, traceback=traceback, verbosity=verbosity, ) dj_call_command( 'migrate', merge=True, ignore_ghost_migrations=True, interactive=interactive, traceback=traceback, verbosity=verbosity, ) from sentry.runner import call_command call_command( 'sentry.runner.commands.repair.repair', )
def devserver(addrport, noreload): dj_call_command( 'runserver', addrport=addrport, use_reloader=not noreload, )
def _loaddata(*fixture_labels): dj_call_command( 'loaddata', *fixture_labels, )
def _check(): try: dj_call_command('check', ) except BaseException as e: exit(e)
def _migrate(interactive, verbosity): dj_call_command( 'migrate', interactive=interactive, verbosity=verbosity, )