33 lines
1.1 KiB
Python
33 lines
1.1 KiB
Python
|
|
"""Add marathon settings (is_public, game_proposal_mode)
|
||
|
|
|
||
|
|
Revision ID: 002_marathon_settings
|
||
|
|
Revises: 001_add_roles
|
||
|
|
Create Date: 2024-12-14
|
||
|
|
|
||
|
|
"""
|
||
|
|
from typing import Sequence, Union
|
||
|
|
|
||
|
|
from alembic import op
|
||
|
|
import sqlalchemy as sa
|
||
|
|
|
||
|
|
# revision identifiers, used by Alembic.
|
||
|
|
revision: str = '002_marathon_settings'
|
||
|
|
down_revision: Union[str, None] = '001_add_roles'
|
||
|
|
branch_labels: Union[str, Sequence[str], None] = None
|
||
|
|
depends_on: Union[str, Sequence[str], None] = None
|
||
|
|
|
||
|
|
|
||
|
|
def upgrade() -> None:
|
||
|
|
# Add is_public column to marathons table (default False = private)
|
||
|
|
op.add_column('marathons', sa.Column('is_public', sa.Boolean(), nullable=False, server_default='false'))
|
||
|
|
|
||
|
|
# Add game_proposal_mode column to marathons table
|
||
|
|
# 'all_participants' - anyone can propose games (with moderation)
|
||
|
|
# 'organizer_only' - only organizers can add games
|
||
|
|
op.add_column('marathons', sa.Column('game_proposal_mode', sa.String(20), nullable=False, server_default='all_participants'))
|
||
|
|
|
||
|
|
|
||
|
|
def downgrade() -> None:
|
||
|
|
op.drop_column('marathons', 'game_proposal_mode')
|
||
|
|
op.drop_column('marathons', 'is_public')
|