"""assessment levels and nrps details Revision ID: 826e2835e289 Revises: 487d155678ea Create Date: 2026-07-31 16:56:00.716357 """ from typing import Sequence, Union from alembic import op import sqlalchemy as sa # revision identifiers, used by Alembic. revision: str = '826e2835e289' down_revision: Union[str, None] = '487d155678ea' branch_labels: Union[str, Sequence[str], None] = None depends_on: Union[str, Sequence[str], None] = None def upgrade() -> None: # ### commands auto generated by Alembic - please adjust! ### with op.batch_alter_table('assessment_levels', schema=None) as batch_op: batch_op.create_unique_constraint(batch_op.f('uq_assessment_levels_course_id'), ['course_id', 'label']) with op.batch_alter_table('calls', schema=None) as batch_op: batch_op.create_foreign_key(batch_op.f('fk_calls_assessment_id_assessment_levels'), 'assessment_levels', ['assessment_id'], ['id']) batch_op.drop_column('assessment') with op.batch_alter_table('class_days', schema=None) as batch_op: batch_op.create_unique_constraint(batch_op.f('uq_class_days_course_id'), ['course_id', 'date']) with op.batch_alter_table('courses', schema=None) as batch_op: batch_op.add_column(sa.Column('lti_issuer', sa.String(length=255), nullable=True)) batch_op.add_column(sa.Column('lti_client_id', sa.String(length=255), nullable=True)) batch_op.add_column(sa.Column('nrps_url', sa.String(length=1024), nullable=True)) batch_op.create_unique_constraint(batch_op.f('uq_courses_lti_context_id'), ['lti_context_id']) with op.batch_alter_table('enrollments', schema=None) as batch_op: batch_op.create_unique_constraint(batch_op.f('uq_enrollments_course_id'), ['course_id', 'student_id']) with op.batch_alter_table('optouts', schema=None) as batch_op: batch_op.create_unique_constraint(batch_op.f('uq_optouts_course_id'), ['course_id', 'student_id', 'date']) with op.batch_alter_table('students', schema=None) as batch_op: batch_op.create_unique_constraint(batch_op.f('uq_students_canvas_user_id'), ['canvas_user_id']) # ### end Alembic commands ### def downgrade() -> None: # ### commands auto generated by Alembic - please adjust! ### with op.batch_alter_table('students', schema=None) as batch_op: batch_op.drop_constraint(batch_op.f('uq_students_canvas_user_id'), type_='unique') with op.batch_alter_table('optouts', schema=None) as batch_op: batch_op.drop_constraint(batch_op.f('uq_optouts_course_id'), type_='unique') with op.batch_alter_table('enrollments', schema=None) as batch_op: batch_op.drop_constraint(batch_op.f('uq_enrollments_course_id'), type_='unique') with op.batch_alter_table('courses', schema=None) as batch_op: batch_op.drop_constraint(batch_op.f('uq_courses_lti_context_id'), type_='unique') batch_op.drop_column('nrps_url') batch_op.drop_column('lti_client_id') batch_op.drop_column('lti_issuer') with op.batch_alter_table('class_days', schema=None) as batch_op: batch_op.drop_constraint(batch_op.f('uq_class_days_course_id'), type_='unique') with op.batch_alter_table('calls', schema=None) as batch_op: batch_op.add_column(sa.Column('assessment', sa.VARCHAR(length=32), nullable=True)) batch_op.drop_constraint(batch_op.f('fk_calls_assessment_id_assessment_levels'), type_='foreignkey') with op.batch_alter_table('assessment_levels', schema=None) as batch_op: batch_op.drop_constraint(batch_op.f('uq_assessment_levels_course_id'), type_='unique') # ### end Alembic commands ###