25 lines
780 B
Python
25 lines
780 B
Python
"""
|
|
Migration: Add location_slots column to job_reservations table.
|
|
Stores the full ordered slot list (including empty/unassigned slots) as JSON.
|
|
Run once per database.
|
|
"""
|
|
import sqlite3
|
|
import os
|
|
|
|
DB_PATH = os.environ.get("DB_PATH", "/app/data/seismo_fleet.db")
|
|
|
|
def run():
|
|
conn = sqlite3.connect(DB_PATH)
|
|
cursor = conn.cursor()
|
|
existing = [r[1] for r in cursor.execute("PRAGMA table_info(job_reservations)").fetchall()]
|
|
if "location_slots" not in existing:
|
|
cursor.execute("ALTER TABLE job_reservations ADD COLUMN location_slots TEXT")
|
|
conn.commit()
|
|
print("Added location_slots column to job_reservations.")
|
|
else:
|
|
print("location_slots column already exists, skipping.")
|
|
conn.close()
|
|
|
|
if __name__ == "__main__":
|
|
run()
|