fediversion/backend/migrations/add_link_columns.py
fullsizemalt b4cddf41ea feat: Initialize Fediversion multi-band platform
- Fork elmeg-demo codebase for multi-band support
- Add data importer infrastructure with base class
- Create band-specific importers:
  - phish.py: Phish.net API v5
  - grateful_dead.py: Grateful Stats API
  - setlistfm.py: Dead & Company, Billy Strings (Setlist.fm)
- Add spec-kit configuration for Gemini
- Update README with supported bands and architecture
2025-12-28 12:39:28 -08:00

35 lines
1.2 KiB
Python

import os
from sqlmodel import create_engine, text
# Get DB URL from env or default (adjust for production)
DATABASE_URL = os.environ.get("DATABASE_URL", "postgresql://elmeg:runfoo@localhost/elmeg")
engine = create_engine(DATABASE_URL)
def run_migration():
with engine.connect() as conn:
print("Adding columns to Show table...")
try:
conn.execute(text("ALTER TABLE show ADD COLUMN bandcamp_link VARCHAR"))
print("Added bandcamp_link")
except Exception as e:
print(f"Skipping bandcamp_link (already exists?)")
try:
conn.execute(text("ALTER TABLE show ADD COLUMN nugs_link VARCHAR"))
print("Added nugs_link")
except Exception as e:
print(f"Skipping nugs_link (already exists?)")
print("Adding columns to Performance table...")
try:
conn.execute(text("ALTER TABLE performance ADD COLUMN track_url VARCHAR"))
print("Added track_url")
except Exception as e:
print(f"Skipping track_url (already exists?)")
conn.commit()
print("Migration complete.")
if __name__ == "__main__":
run_migration()