46 lines
1.4 KiB
Python
46 lines
1.4 KiB
Python
"""create_event_table
|
|
|
|
Revision ID: 858e0d45876f
|
|
Revises: 261c004968a4
|
|
Create Date: 2023-12-01 13:31:00.955470
|
|
|
|
"""
|
|
from alembic import op
|
|
import sqlalchemy as sa
|
|
|
|
|
|
# revision identifiers, used by Alembic.
|
|
revision = '858e0d45876f'
|
|
down_revision = '261c004968a4'
|
|
branch_labels = None
|
|
depends_on = None
|
|
|
|
|
|
def upgrade():
|
|
# ### commands auto generated by Alembic - please adjust! ###
|
|
op.create_table('event',
|
|
sa.Column('id', sa.Integer(), nullable=False),
|
|
sa.Column('name', sa.String(), nullable=False),
|
|
sa.Column('description', sa.String(), nullable=True),
|
|
sa.Column('location', sa.String(), nullable=False),
|
|
sa.Column('start_time', sa.DateTime(), nullable=False),
|
|
sa.Column('end_time', sa.DateTime(), nullable=False),
|
|
sa.Column('category', sa.String(), nullable=True),
|
|
sa.PrimaryKeyConstraint('id')
|
|
)
|
|
op.create_table('event_checkins',
|
|
sa.Column('id', sa.Integer(), nullable=False),
|
|
sa.Column('event_id', sa.Integer(), nullable=False),
|
|
sa.Column('user_id', sa.Integer(), nullable=False),
|
|
sa.ForeignKeyConstraint(['event_id'], ['event.id'], ),
|
|
sa.ForeignKeyConstraint(['user_id'], ['user.id'], ),
|
|
sa.PrimaryKeyConstraint('id')
|
|
)
|
|
# ### end Alembic commands ###
|
|
|
|
|
|
def downgrade():
|
|
# ### commands auto generated by Alembic - please adjust! ###
|
|
op.drop_table('event_checkins')
|
|
op.drop_table('event')
|
|
# ### end Alembic commands ###
|