add previous schema for compat

This commit is contained in:
2025-06-29 18:27:55 +03:00
parent 765e445bbf
commit 7b17efd7cc
3 changed files with 95 additions and 7 deletions

View File

@ -6,13 +6,16 @@ MIGRATIONS = {
}
def run_migrations():
print("Running migrations...")
ran = 0
db.execute("""
CREATE TABLE IF NOT EXISTS _migrations(
id INTEGER PRIMARY KEY
)
""")
if len(MIGRATIONS) == 0:
print("No migrations defined.")
return
print("Running migrations...")
ran = 0
completed = [row["id"] for row in db.query("SELECT id FROM _migrations")]
for migration_id in sorted(MIGRATIONS.keys()):
if migration_id not in completed: