Skip to content

Commit d78b723

Browse files
committed
Fail if schema creation didn't work right
1 parent 9b5cdbd commit d78b723

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

sogs/db.py

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -117,6 +117,14 @@ def database_init():
117117
metadata.clear()
118118
metadata.reflect(bind=engine, views=True)
119119

120+
if 'messages' not in metadata.tables:
121+
msg = (
122+
"Critical error: SQL schema creation failed; "
123+
f"tables: {', '.join(metadata.tables.keys())}"
124+
)
125+
logging.critical(msg)
126+
raise RuntimeError(msg)
127+
120128
changes = False
121129

122130
# Database migrations/updates/etc.

0 commit comments

Comments
 (0)