"""add_event_system Revision ID: a35876e08b8e Revises: 7bf40aa6c4b5 Create Date: 2026-03-31 12:51:29.923126 """ from typing import Sequence, Union from alembic import op import sqlalchemy as sa revision: str = 'a35876e08b8e' down_revision: Union[str, None] = '7bf40aa6c4b5' branch_labels: Union[str, Sequence[str], None] = None depends_on: Union[str, Sequence[str], None] = None def upgrade() -> None: op.create_table('events', sa.Column('id', sa.Integer(), autoincrement=True, nullable=False), sa.Column('creator_id', sa.Integer(), nullable=False), sa.Column('title', sa.String(length=200), nullable=False), sa.Column('city', sa.String(length=100), nullable=False), sa.Column('description', sa.Text(), nullable=True), sa.Column('cover_url', sa.String(length=500), nullable=True), sa.Column('location_name', sa.String(length=200), nullable=True), sa.Column('start_time', sa.DateTime(timezone=True), nullable=True), sa.Column('end_time', sa.DateTime(timezone=True), nullable=True), sa.Column('max_participants', sa.Integer(), nullable=False), sa.Column('spot_id', sa.Integer(), nullable=True), sa.Column('status', sa.String(length=20), nullable=False), sa.Column('audit_status', sa.String(length=20), nullable=False), sa.Column('reject_reason', sa.String(length=500), nullable=True), sa.Column('registration_count', sa.Integer(), nullable=False), sa.Column('created_at', sa.DateTime(timezone=True), server_default=sa.text('now()'), nullable=False), sa.Column('updated_at', sa.DateTime(timezone=True), server_default=sa.text('now()'), nullable=False), sa.ForeignKeyConstraint(['creator_id'], ['users.id'], ), sa.ForeignKeyConstraint(['spot_id'], ['spots.id'], ), sa.PrimaryKeyConstraint('id') ) op.create_index(op.f('ix_events_city'), 'events', ['city'], unique=False) op.create_index(op.f('ix_events_creator_id'), 'events', ['creator_id'], unique=False) op.create_index(op.f('ix_events_status'), 'events', ['status'], unique=False) op.create_table('event_photos', sa.Column('id', sa.Integer(), autoincrement=True, nullable=False), sa.Column('event_id', sa.Integer(), nullable=False), sa.Column('uploader_id', sa.Integer(), nullable=False), sa.Column('image_url', sa.String(length=500), nullable=False), sa.Column('caption', sa.String(length=200), nullable=True), sa.Column('spot_id', sa.Integer(), nullable=True), sa.Column('created_at', sa.DateTime(timezone=True), server_default=sa.text('now()'), nullable=False), sa.ForeignKeyConstraint(['event_id'], ['events.id'], ), sa.ForeignKeyConstraint(['spot_id'], ['spots.id'], ), sa.ForeignKeyConstraint(['uploader_id'], ['users.id'], ), sa.PrimaryKeyConstraint('id') ) op.create_index(op.f('ix_event_photos_event_id'), 'event_photos', ['event_id'], unique=False) op.create_table('event_registrations', sa.Column('id', sa.Integer(), autoincrement=True, nullable=False), sa.Column('event_id', sa.Integer(), nullable=False), sa.Column('user_id', sa.Integer(), nullable=False), sa.Column('status', sa.String(length=20), nullable=False), sa.Column('created_at', sa.DateTime(timezone=True), server_default=sa.text('now()'), nullable=False), sa.ForeignKeyConstraint(['event_id'], ['events.id'], ), sa.ForeignKeyConstraint(['user_id'], ['users.id'], ), sa.PrimaryKeyConstraint('id') ) op.create_index(op.f('ix_event_registrations_event_id'), 'event_registrations', ['event_id'], unique=False) op.create_index(op.f('ix_event_registrations_user_id'), 'event_registrations', ['user_id'], unique=False) def downgrade() -> None: op.drop_index(op.f('ix_event_registrations_user_id'), table_name='event_registrations') op.drop_index(op.f('ix_event_registrations_event_id'), table_name='event_registrations') op.drop_table('event_registrations') op.drop_index(op.f('ix_event_photos_event_id'), table_name='event_photos') op.drop_table('event_photos') op.drop_index(op.f('ix_events_status'), table_name='events') op.drop_index(op.f('ix_events_creator_id'), table_name='events') op.drop_index(op.f('ix_events_city'), table_name='events') op.drop_table('events')