fediversion/backend/alembic/versions/341b95b6e098_add_gamification_models.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

58 lines
2 KiB
Python

"""Add gamification models
Revision ID: 341b95b6e098
Revises: 366067fc1318
Create Date: 2025-12-02 02:59:20.293100
"""
from typing import Sequence, Union
from alembic import op
import sqlalchemy as sa
import sqlmodel
# revision identifiers, used by Alembic.
revision: str = '341b95b6e098'
down_revision: Union[str, Sequence[str], None] = '366067fc1318'
branch_labels: Union[str, Sequence[str], None] = None
depends_on: Union[str, Sequence[str], None] = None
def upgrade() -> None:
"""Upgrade schema."""
# ### commands auto generated by Alembic - please adjust! ###
op.create_table('badge',
sa.Column('id', sa.Integer(), nullable=False),
sa.Column('name', sqlmodel.sql.sqltypes.AutoString(), nullable=False),
sa.Column('description', sqlmodel.sql.sqltypes.AutoString(), nullable=False),
sa.Column('icon', sqlmodel.sql.sqltypes.AutoString(), nullable=False),
sa.Column('slug', sqlmodel.sql.sqltypes.AutoString(), nullable=False),
sa.PrimaryKeyConstraint('id')
)
with op.batch_alter_table('badge', schema=None) as batch_op:
batch_op.create_index(batch_op.f('ix_badge_name'), ['name'], unique=True)
batch_op.create_index(batch_op.f('ix_badge_slug'), ['slug'], unique=True)
op.create_table('userbadge',
sa.Column('id', sa.Integer(), nullable=False),
sa.Column('user_id', sa.Integer(), nullable=False),
sa.Column('badge_id', sa.Integer(), nullable=False),
sa.Column('awarded_at', sa.DateTime(), nullable=False),
sa.ForeignKeyConstraint(['badge_id'], ['badge.id'], ),
sa.ForeignKeyConstraint(['user_id'], ['user.id'], ),
sa.PrimaryKeyConstraint('id')
)
# ### end Alembic commands ###
def downgrade() -> None:
"""Downgrade schema."""
# ### commands auto generated by Alembic - please adjust! ###
op.drop_table('userbadge')
with op.batch_alter_table('badge', schema=None) as batch_op:
batch_op.drop_index(batch_op.f('ix_badge_slug'))
batch_op.drop_index(batch_op.f('ix_badge_name'))
op.drop_table('badge')
# ### end Alembic commands ###