b1: db — guarded migrations: listings.imgs (gallery JSON) + swipes.last_photo_idx

This commit is contained in:
Torres
2026-11-11 00:02:42 -04:00
parent 6de2fcc1bd
commit 3b64635339

View File

@@ -95,6 +95,13 @@ def init_db(conn):
conn.execute('ALTER TABLE listings ADD COLUMN seller_type TEXT')
if 'extras' not in cols:
conn.execute('ALTER TABLE listings ADD COLUMN extras TEXT')
# B1 (photo experience v2): gallery URLs + swipe-time photo index.
if 'imgs' not in cols:
conn.execute('ALTER TABLE listings ADD COLUMN imgs TEXT')
sw_cols = {r['name'] for r in conn.execute(
"PRAGMA table_info('swipes')")}
if 'last_photo_idx' not in sw_cols:
conn.execute('ALTER TABLE swipes ADD COLUMN last_photo_idx INTEGER')
# P3 tables (idempotent on every call)
conn.executescript(P3_SCHEMA)
# P3 event seeding: one round-1 event per existing swipe, copied