fix(initdb.py): skip db initialization with env var
Only run the db-initialization (e.g. creating schemas) if the `SKIP_DB_SCHEMAS` isn't set to true when run as main. This value is checked in other circumstances and should be here as well so that this script can be used to populate arbitrary test databases as needed in development.
This commit is contained in:
parent
a726a12096
commit
243b0dc4fc
1 changed files with 2 additions and 1 deletions
|
@ -842,7 +842,8 @@ if __name__ == '__main__':
|
|||
if not IS_TESTING_REAL_DATABASE and not isinstance(db.obj, SqliteDatabase):
|
||||
raise RuntimeError('Attempted to initialize production database!')
|
||||
|
||||
initialize_database()
|
||||
if os.environ.get('SKIP_DB_SCHEMA', '').lower() != 'true':
|
||||
initialize_database()
|
||||
|
||||
populate_database(args.simple)
|
||||
|
||||
|
|
Reference in a new issue