#35 Added course code field to Course model. Updated class functions to reflect change. Also added duplicate checking for create course endpoint

This commit was merged in pull request #36.
This commit is contained in:
2023-04-06 22:00:11 -04:00
parent dcb9111288
commit d5d2d830cc
3 changed files with 43 additions and 4 deletions

View File

@@ -0,0 +1,34 @@
"""Add course code
Revision ID: 862905f5e34a
Revises: 093a66f0b581
Create Date: 2023-04-06 21:55:54.838647
"""
from alembic import op
import sqlalchemy as sa
# revision identifiers, used by Alembic.
revision = '862905f5e34a'
down_revision = '093a66f0b581'
branch_labels = None
depends_on = None
def upgrade():
# ### commands auto generated by Alembic - please adjust! ###
with op.batch_alter_table('course', schema=None) as batch_op:
batch_op.add_column(sa.Column('course_code', sa.String(length=32), nullable=True))
batch_op.create_index(batch_op.f('ix_course_course_code'), ['course_code'], unique=False)
# ### end Alembic commands ###
def downgrade():
# ### commands auto generated by Alembic - please adjust! ###
with op.batch_alter_table('course', schema=None) as batch_op:
batch_op.drop_index(batch_op.f('ix_course_course_code'))
batch_op.drop_column('course_code')
# ### end Alembic commands ###