-
Notifications
You must be signed in to change notification settings - Fork 19
/
build_db.py
34 lines (27 loc) · 976 Bytes
/
build_db.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
from microsetta_private_api.LEGACY.env_management import (
create_database, initialize, patch_db, populate_test_db)
DB = 'test'
FORCE = True
def make(db, force):
"""Creates the specified database."""
print("Creating database")
create_database(force)
if db == 'production':
# build(verbose=True)
initialize(verbose=True)
# print("Making settings table")
# make_settings_table()
elif db == 'test':
# Test database includes initialization and settings table already
print("Populating the test database")
try:
populate_test_db()
except RuntimeError as err:
print("Something went terribly wrong but we're going to pretend"
" that it's fine.")
print(err)
initialize(verbose=True)
print("Applying patches to database")
patch_db(verbose=True)
print("{} environment successfully created".format(db))
make(DB, FORCE)