Sarolanda commited on
Commit
f3eb1eb
Β·
1 Parent(s): 30c7730

fix: auto-migrate sightings table to add is_help_event and help_type columns

Browse files
Files changed (1) hide show
  1. core/database.py +6 -0
core/database.py CHANGED
@@ -63,6 +63,12 @@ class Database:
63
  " created_at DATETIME DEFAULT CURRENT_TIMESTAMP"
64
  ");"
65
  )
 
 
 
 
 
 
66
 
67
  # ─── Photos ──────────────────────────────────────────────────────────────
68
 
 
63
  " created_at DATETIME DEFAULT CURRENT_TIMESTAMP"
64
  ");"
65
  )
66
+ # Incremental migrations β€” safe to run on every startup
67
+ cols = {row[1] for row in conn.execute("PRAGMA table_info(sightings)").fetchall()}
68
+ if "is_help_event" not in cols:
69
+ conn.execute("ALTER TABLE sightings ADD COLUMN is_help_event INTEGER NOT NULL DEFAULT 0")
70
+ if "help_type" not in cols:
71
+ conn.execute("ALTER TABLE sightings ADD COLUMN help_type TEXT")
72
 
73
  # ─── Photos ──────────────────────────────────────────────────────────────
74