fediversion/backend/migrations/add_rating_venue_tour.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

43 lines
1.2 KiB
Python

"""Add venue_id and tour_id columns to rating table"""
import os
import sys
sys.path.insert(0, os.path.dirname(os.path.dirname(os.path.abspath(__file__))))
from database import DATABASE_URL
import psycopg2
def run():
conn = psycopg2.connect(DATABASE_URL)
cur = conn.cursor()
# Add venue_id column
try:
cur.execute("ALTER TABLE rating ADD COLUMN venue_id INTEGER REFERENCES venue(id)")
print("✅ Added venue_id to rating")
except Exception as e:
if "already exists" in str(e):
print("⚠️ venue_id column already exists")
else:
print(f"❌ Error adding venue_id: {e}")
conn.rollback()
else:
conn.commit()
# Add tour_id column
try:
cur.execute("ALTER TABLE rating ADD COLUMN tour_id INTEGER REFERENCES tour(id)")
print("✅ Added tour_id to rating")
except Exception as e:
if "already exists" in str(e):
print("⚠️ tour_id column already exists")
else:
print(f"❌ Error adding tour_id: {e}")
conn.rollback()
else:
conn.commit()
cur.close()
conn.close()
if __name__ == "__main__":
run()