From 243b0dc4fc41b6b4a3223357a1d4a1cfb798a3e8 Mon Sep 17 00:00:00 2001 From: EvB Date: Wed, 22 Feb 2017 17:55:17 -0500 Subject: [PATCH] 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. --- initdb.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/initdb.py b/initdb.py index 2c1615cf7..9c93c7254 100644 --- a/initdb.py +++ b/initdb.py @@ -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)