Files

35 lines
901 B
Python

"""Create enrollment table
Revision ID: 093a66f0b581
Revises: 471b4225837e
Create Date: 2023-04-06 16:14:21.262823
"""
from alembic import op
import sqlalchemy as sa
# revision identifiers, used by Alembic.
revision = '093a66f0b581'
down_revision = '471b4225837e'
branch_labels = None
depends_on = None
def upgrade():
# ### commands auto generated by Alembic - please adjust! ###
op.create_table('enrollment',
sa.Column('user_id', sa.Integer(), nullable=False),
sa.Column('course_id', sa.Integer(), nullable=False),
sa.ForeignKeyConstraint(['course_id'], ['course.id'], ),
sa.ForeignKeyConstraint(['user_id'], ['user.id'], ),
sa.PrimaryKeyConstraint('user_id', 'course_id')
)
# ### end Alembic commands ###
def downgrade():
# ### commands auto generated by Alembic - please adjust! ###
op.drop_table('enrollment')
# ### end Alembic commands ###