elmeg-demo/backend/migrations/add_youtube_links.py

24 lines
762 B
Python

"""
Migration to add youtube_link column to show, song, and performance tables.
"""
from sqlmodel import Session, create_engine, text
from database import DATABASE_URL
def add_youtube_link_columns():
engine = create_engine(DATABASE_URL)
tables = ['show', 'song', 'performance']
with Session(engine) as session:
for table in tables:
try:
session.exec(text(f"""
ALTER TABLE "{table}" ADD COLUMN IF NOT EXISTS youtube_link VARCHAR
"""))
session.commit()
print(f"✅ Added youtube_link to {table}")
except Exception as e:
print(f"⚠️ {table}: {e}")
if __name__ == "__main__":
add_youtube_link_columns()