rebuild(stage-15): complete governance and handoff
This commit is contained in:
@@ -20,6 +20,12 @@ class DatabaseStatusRepository:
|
||||
try:
|
||||
with self._database.read() as connection:
|
||||
connection.execute("SELECT 1").fetchone()
|
||||
schema_exists = connection.execute(
|
||||
"""SELECT 1 FROM sqlite_master
|
||||
WHERE type='table' AND name='schema_migrations'"""
|
||||
).fetchone()
|
||||
if schema_exists is None:
|
||||
return DatabaseStatus(available=True, schema_version=0)
|
||||
row = connection.execute(
|
||||
"SELECT COALESCE(MAX(version), 0) AS version FROM schema_migrations"
|
||||
).fetchone()
|
||||
|
||||
Reference in New Issue
Block a user