Spaces:
Sleeping
Sleeping
Add PG migration for big_picture and what_you_can_do columns
Browse files- backend/storage.py +16 -0
backend/storage.py
CHANGED
|
@@ -197,6 +197,22 @@ def _init_pg():
|
|
| 197 |
cur.execute("""
|
| 198 |
CREATE INDEX IF NOT EXISTS idx_minutes_city ON minutes(city, state);
|
| 199 |
""")
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 200 |
conn.commit()
|
| 201 |
finally:
|
| 202 |
conn.close()
|
|
|
|
| 197 |
cur.execute("""
|
| 198 |
CREATE INDEX IF NOT EXISTS idx_minutes_city ON minutes(city, state);
|
| 199 |
""")
|
| 200 |
+
# Migration: add big_picture and what_you_can_do columns if they don't exist
|
| 201 |
+
# Safe to run multiple times — IF NOT EXISTS prevents errors
|
| 202 |
+
try:
|
| 203 |
+
cur.execute("""
|
| 204 |
+
ALTER TABLE minutes_summaries
|
| 205 |
+
ADD COLUMN IF NOT EXISTS big_picture TEXT NOT NULL DEFAULT ''
|
| 206 |
+
""")
|
| 207 |
+
except Exception:
|
| 208 |
+
pass # Some PG versions don't support IF NOT EXISTS for columns
|
| 209 |
+
try:
|
| 210 |
+
cur.execute("""
|
| 211 |
+
ALTER TABLE minutes_summaries
|
| 212 |
+
ADD COLUMN IF NOT EXISTS what_you_can_do TEXT NOT NULL DEFAULT '[]'
|
| 213 |
+
""")
|
| 214 |
+
except Exception:
|
| 215 |
+
pass
|
| 216 |
conn.commit()
|
| 217 |
finally:
|
| 218 |
conn.close()
|