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:
EvB 2017-02-22 17:55:17 -05:00
parent a726a12096
commit 243b0dc4fc

View file

@ -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)