Skip to content

Commit

Permalink
Migration for assignment.course_id
Browse files Browse the repository at this point in the history
  • Loading branch information
marcospri committed Aug 6, 2024
1 parent b471df8 commit a2a1bb4
Showing 1 changed file with 25 additions and 0 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
"""Add assignment course relationship."""

import sqlalchemy as sa
from alembic import op

revision = "18109b584a5b"
down_revision = "d8d33d882b88"


def upgrade() -> None:
op.add_column("assignment", sa.Column("course_id", sa.Integer(), nullable=True))
op.create_foreign_key(
op.f("fk__assignment__course_id__grouping"),
"assignment",
"grouping",
["course_id"],
["id"],
)


def downgrade() -> None:
op.drop_constraint(
op.f("fk__assignment__course_id__grouping"), "assignment", type_="foreignkey"
)
op.drop_column("assignment", "course_id")

0 comments on commit a2a1bb4

Please sign in to comment.