Fix 502 after update: safe startup, single DB init, healthcheck

Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
2026-06-06 22:58:09 +03:00
parent 82fdb60f5e
commit 5353c82066
10 changed files with 107 additions and 52 deletions
+6 -5
View File
@@ -319,9 +319,10 @@ def ensure_folder_schema():
tables = inspector.get_table_names()
if "photos" in tables:
columns = {col["name"] for col in inspector.get_columns("photos")}
if "folder_id" not in columns:
db.session.execute(
text("ALTER TABLE photos ADD COLUMN folder_id INTEGER REFERENCES folders(id)")
db.session.execute(
text(
"ALTER TABLE photos ADD COLUMN IF NOT EXISTS "
"folder_id INTEGER REFERENCES folders(id)"
)
db.session.commit()
)
db.session.commit()