Files
psalmbordonline/migrations/versions/168fdd980dba_initial_migration.py
2025-12-10 22:47:38 +01:00

89 lines
3.5 KiB
Python

"""Initial migration
Revision ID: 168fdd980dba
Revises:
Create Date: 2025-07-31 10:56:01.296387
"""
from alembic import op
import sqlalchemy as sa
# revision identifiers, used by Alembic.
revision = '168fdd980dba'
down_revision = None
branch_labels = None
depends_on = None
def upgrade():
# ### commands auto generated by Alembic - please adjust! ###
op.create_table('church',
sa.Column('id', sa.Integer(), nullable=False),
sa.Column('name', sa.String(length=150), nullable=False),
sa.Column('is_active', sa.Boolean(), nullable=False),
sa.Column('contact_email', sa.String(length=150), nullable=True),
sa.Column('contact_phone', sa.String(length=50), nullable=True),
sa.Column('contact_address', sa.String(length=200), nullable=True),
sa.Column('logo_filename', sa.String(length=300), nullable=True),
sa.PrimaryKeyConstraint('id'),
sa.UniqueConstraint('name')
)
op.create_table('schedule',
sa.Column('id', sa.Integer(), nullable=False),
sa.Column('name', sa.String(length=150), nullable=False),
sa.Column('start_time', sa.Time(), nullable=False),
sa.Column('end_time', sa.Time(), nullable=False),
sa.Column('date', sa.Date(), nullable=False),
sa.Column('content', sa.Text(), nullable=False),
sa.PrimaryKeyConstraint('id')
)
op.create_table('liturgiebord',
sa.Column('id', sa.Integer(), nullable=False),
sa.Column('unique_id', sa.String(length=32), nullable=False),
sa.Column('name', sa.String(length=150), nullable=False),
sa.Column('church_id', sa.Integer(), nullable=False),
sa.Column('line1', sa.String(length=200), nullable=True),
sa.Column('line2', sa.String(length=200), nullable=True),
sa.Column('line3', sa.String(length=200), nullable=True),
sa.Column('line4', sa.String(length=200), nullable=True),
sa.Column('line5', sa.String(length=200), nullable=True),
sa.Column('line6', sa.String(length=200), nullable=True),
sa.Column('line7', sa.String(length=200), nullable=True),
sa.Column('line8', sa.String(length=200), nullable=True),
sa.Column('line9', sa.String(length=200), nullable=True),
sa.Column('line10', sa.String(length=200), nullable=True),
sa.Column('background_image', sa.String(length=300), nullable=True),
sa.ForeignKeyConstraint(['church_id'], ['church.id'], ),
sa.PrimaryKeyConstraint('id'),
sa.UniqueConstraint('unique_id')
)
op.create_table('user',
sa.Column('id', sa.Integer(), nullable=False),
sa.Column('username', sa.String(length=150), nullable=False),
sa.Column('password', sa.String(length=150), nullable=False),
sa.Column('church_id', sa.Integer(), nullable=False),
sa.Column('is_admin', sa.Boolean(), nullable=True),
sa.ForeignKeyConstraint(['church_id'], ['church.id'], ),
sa.PrimaryKeyConstraint('id'),
sa.UniqueConstraint('username')
)
op.create_table('board_schedule',
sa.Column('board_id', sa.Integer(), nullable=False),
sa.Column('schedule_id', sa.Integer(), nullable=False),
sa.ForeignKeyConstraint(['board_id'], ['liturgiebord.id'], ),
sa.ForeignKeyConstraint(['schedule_id'], ['schedule.id'], ),
sa.PrimaryKeyConstraint('board_id', 'schedule_id')
)
# ### end Alembic commands ###
def downgrade():
# ### commands auto generated by Alembic - please adjust! ###
op.drop_table('board_schedule')
op.drop_table('user')
op.drop_table('liturgiebord')
op.drop_table('schedule')
op.drop_table('church')
# ### end Alembic commands ###