26 lines
685 B
Python
26 lines
685 B
Python
import sqlite3
|
|
|
|
def migrate():
|
|
db_path = "data/parking.db"
|
|
try:
|
|
conn = sqlite3.connect(db_path)
|
|
cursor = conn.cursor()
|
|
|
|
# Add the new column
|
|
cursor.execute("ALTER TABLE offices ADD COLUMN assignment_mode VARCHAR DEFAULT 'fairness'")
|
|
|
|
print("Success: Added assignment_mode to offices table.")
|
|
|
|
conn.commit()
|
|
except sqlite3.OperationalError as e:
|
|
if "duplicate column name" in str(e):
|
|
print("Info: Column assignment_mode already exists.")
|
|
else:
|
|
print(f"Error: {e}")
|
|
finally:
|
|
if conn:
|
|
conn.close()
|
|
|
|
if __name__ == "__main__":
|
|
migrate()
|