Beispiel #1
0
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")
Beispiel #2
0
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")
Beispiel #3
0
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',
        )
Beispiel #4
0
 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()")
Beispiel #5
0
def migrate():
    click.secho('Applying database migrations:', fg='green')

    dj_call_command(
        'migrate',
        interactive=False,
        verbosity=1,
    )
Beispiel #6
0
    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)
Beispiel #7
0
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()
Beispiel #8
0
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")
Beispiel #9
0
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,
    )
Beispiel #10
0
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', )
Beispiel #11
0
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',
    )
Beispiel #12
0
def devserver(addrport, noreload):
    dj_call_command(
        'runserver',
        addrport=addrport,
        use_reloader=not noreload,
    )
Beispiel #13
0
def _loaddata(*fixture_labels):
    dj_call_command(
        'loaddata',
        *fixture_labels,
    )
Beispiel #14
0
def _check():
    try:
        dj_call_command('check', )
    except BaseException as e:
        exit(e)
Beispiel #15
0
def _migrate(interactive, verbosity):
    dj_call_command(
        'migrate',
        interactive=interactive,
        verbosity=verbosity,
    )