b1: db — guarded migrations: listings.imgs (gallery JSON) + swipes.last_photo_idx
This commit is contained in:
@@ -95,6 +95,13 @@ def init_db(conn):
|
|||||||
conn.execute('ALTER TABLE listings ADD COLUMN seller_type TEXT')
|
conn.execute('ALTER TABLE listings ADD COLUMN seller_type TEXT')
|
||||||
if 'extras' not in cols:
|
if 'extras' not in cols:
|
||||||
conn.execute('ALTER TABLE listings ADD COLUMN extras TEXT')
|
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)
|
# P3 tables (idempotent on every call)
|
||||||
conn.executescript(P3_SCHEMA)
|
conn.executescript(P3_SCHEMA)
|
||||||
# P3 event seeding: one round-1 event per existing swipe, copied
|
# P3 event seeding: one round-1 event per existing swipe, copied
|
||||||
|
|||||||
Reference in New Issue
Block a user