@@ -46,32 +46,33 @@ def handle(self, *args, **options):
46
46
# Always ensure "olympia" database exists and is accessible.
47
47
call_command ('monitors' , services = ['olympia_database' , 'elastic' ])
48
48
49
- # If we are not skipping data backup
50
- # then run the logic to ensure the DB is ready.
51
- if not settings .DATA_BACKUP_SKIP :
52
- # If DB empty or we are explicitly cleaning, then bail with data_seed.
53
- if options .get ('clean' ) or not self .local_admin_exists ():
54
- call_command ('data_seed' )
55
- # Otherwise, we're working with a pre-existing DB.
49
+ if (
50
+ # If we are not skipping data seeding
51
+ not settings .SKIP_DATA_SEED
52
+ # and we are either explicitly cleaning or loading a fresh db
53
+ and (options .get ('clean' ) or not self .local_admin_exists ())
54
+ ):
55
+ call_command ('data_seed' )
56
+ # Otherwise, we're working with a pre-existing DB.
57
+ else :
58
+ load = options .get ('load' )
59
+ # We always migrate the DB.
60
+ logging .info ('Migrating...' )
61
+ call_command ('migrate' , '--noinput' )
62
+
63
+ # If we specify a specific backup, simply load that.
64
+ if load :
65
+ call_command ('data_load' , '--name' , load )
66
+ # We should reindex even if no data is loaded/modified
67
+ # because we might have a fresh instance of elasticsearch
56
68
else :
57
- load = options .get ('load' )
58
- # We always migrate the DB.
59
- logging .info ('Migrating...' )
60
- call_command ('migrate' , '--noinput' )
61
-
62
- # If we specify a specific backup, simply load that.
63
- if load :
64
- call_command ('data_load' , '--name' , load )
65
- # We should reindex even if no data is loaded/modified
66
- # because we might have a fresh instance of elasticsearch
67
- else :
68
- call_command (
69
- 'reindex' , '--wipe' , '--force' , '--noinput' , '--skip-if-exists'
70
- )
71
-
72
- # By now, we excpect the database to exist, and to be migrated
73
- # so our database tables should be accessible
74
- call_command ('monitors' , services = ['database' ])
69
+ call_command (
70
+ 'reindex' , '--wipe' , '--force' , '--noinput' , '--skip-if-exists'
71
+ )
72
+
73
+ # By now, we excpect the database to exist, and to be migrated
74
+ # so our database tables should be accessible
75
+ call_command ('monitors' , services = ['database' ])
75
76
76
77
# Ensure that the storage directories exist.
77
78
self .make_storage (clean = False )
0 commit comments