Skip to content

Commit d45ae1d

Browse files
authored
Adds a --no-repair flag to upgrade (#4217)
On large installs, repair is really painful. The only alternative right now is by digging in and using `sentry django syncdb/migrate` manually. WHich is a bit of an implementation detail. This just surfaces the ability to skip repair step.
1 parent 412873f commit d45ae1d

File tree

1 file changed

+10
-8
lines changed

1 file changed

+10
-8
lines changed

src/sentry/runner/commands/upgrade.py

Lines changed: 10 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
from sentry.runner.decorators import configuration
1212

1313

14-
def _upgrade(interactive, traceback, verbosity):
14+
def _upgrade(interactive, traceback, verbosity, repair):
1515
from django.core.management import call_command as dj_call_command
1616
dj_call_command(
1717
'syncdb',
@@ -29,20 +29,22 @@ def _upgrade(interactive, traceback, verbosity):
2929
verbosity=verbosity,
3030
)
3131

32-
from sentry.runner import call_command
33-
call_command(
34-
'sentry.runner.commands.repair.repair',
35-
)
32+
if repair:
33+
from sentry.runner import call_command
34+
call_command(
35+
'sentry.runner.commands.repair.repair',
36+
)
3637

3738

3839
@click.command()
3940
@click.option('--verbosity', '-v', default=1, help='Verbosity level.')
4041
@click.option('--traceback', default=True, is_flag=True, help='Raise on exception.')
4142
@click.option('--noinput', default=False, is_flag=True, help='Do not prompt the user for input of any kind.')
4243
@click.option('--lock', default=False, is_flag=True, help='Hold a global lock and limit upgrade to one concurrent.')
44+
@click.option('--no-repair', default=False, is_flag=True, help='Skip repair step.')
4345
@configuration
4446
@click.pass_context
45-
def upgrade(ctx, verbosity, traceback, noinput, lock):
47+
def upgrade(ctx, verbosity, traceback, noinput, lock, no_repair):
4648
"Perform any pending database migrations and upgrades."
4749

4850
if lock:
@@ -51,8 +53,8 @@ def upgrade(ctx, verbosity, traceback, noinput, lock):
5153
lock = locks.get('upgrade', duration=0)
5254
try:
5355
with lock.acquire():
54-
_upgrade(not noinput, traceback, verbosity)
56+
_upgrade(not noinput, traceback, verbosity, not no_repair)
5557
except UnableToAcquireLock:
5658
raise click.ClickException('Unable to acquire `upgrade` lock.')
5759
else:
58-
_upgrade(not noinput, traceback, verbosity)
60+
_upgrade(not noinput, traceback, verbosity, not no_repair)

0 commit comments

Comments
 (0)