rebuild(stage-15): complete governance and handoff

This commit is contained in:
leefer
2026-07-30 08:46:12 +08:00
parent fa7a8dde06
commit d1b3b977d2
14 changed files with 498 additions and 13 deletions
@@ -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()