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

26 lines
1.1 KiB
Python

from sqlmodel import Session, create_engine, text
from database import DATABASE_URL
def add_reaction_table():
engine = create_engine(DATABASE_URL)
with Session(engine) as session:
try:
session.exec(text("""
CREATE TABLE IF NOT EXISTS reaction (
id SERIAL PRIMARY KEY,
user_id INTEGER NOT NULL REFERENCES "user"(id),
entity_type VARCHAR NOT NULL,
entity_id INTEGER NOT NULL,
emoji VARCHAR NOT NULL,
created_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP
)
"""))
session.exec(text("CREATE INDEX IF NOT EXISTS ix_reaction_entity_type ON reaction (entity_type)"))
session.exec(text("CREATE INDEX IF NOT EXISTS ix_reaction_entity_id ON reaction (entity_id)"))
session.commit()
print("Successfully created reaction table")
except Exception as e:
print(f"Error creating table: {e}")
if __name__ == "__main__":
add_reaction_table()