23 lines
824 B
Python
23 lines
824 B
Python
import asyncio
|
|
from sqlalchemy import text
|
|
from app.core.database import engine
|
|
|
|
async def add_columns():
|
|
print("Starting schema update...")
|
|
async with engine.begin() as conn:
|
|
try:
|
|
await conn.execute(text("ALTER TABLE tickets ADD COLUMN system_id UUID REFERENCES systems(id)"))
|
|
print("Added system_id column")
|
|
except Exception as e:
|
|
print(f"Error adding system_id (might exist): {e}")
|
|
|
|
try:
|
|
await conn.execute(text("ALTER TABLE tickets ADD COLUMN category_id UUID REFERENCES categories(id)"))
|
|
print("Added category_id column")
|
|
except Exception as e:
|
|
print(f"Error adding category_id (might exist): {e}")
|
|
print("Schema update finished.")
|
|
|
|
if __name__ == "__main__":
|
|
asyncio.run(add_columns())
|