#11 Added enrollment table and relationship between user/couse
This commit is contained in:
34
backend/migrations/versions/093a66f0b581_.py
Normal file
34
backend/migrations/versions/093a66f0b581_.py
Normal file
@@ -0,0 +1,34 @@
|
||||
"""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 ###
|
||||
Reference in New Issue
Block a user