no-mistakes(review): Extend ensure_legacy_schema to add tickets.reported_at with backfill
This commit is contained in:
@@ -38,6 +38,14 @@ async def ensure_legacy_schema(conn) -> None:
|
||||
text("ALTER TABLE tickets ADD COLUMN phone VARCHAR(50)")
|
||||
)
|
||||
logger.info("Added missing tickets.phone column (legacy database)")
|
||||
if "reported_at" not in ticket_columns:
|
||||
await conn.execute(
|
||||
text("ALTER TABLE tickets ADD COLUMN reported_at DATETIME")
|
||||
)
|
||||
await conn.execute(
|
||||
text("UPDATE tickets SET reported_at = created_at WHERE reported_at IS NULL")
|
||||
)
|
||||
logger.info("Added missing tickets.reported_at column (legacy database)")
|
||||
result = await conn.execute(
|
||||
text(
|
||||
"UPDATE categories SET name = 'Missing Item' "
|
||||
|
||||
Reference in New Issue
Block a user