-
Notifications
You must be signed in to change notification settings - Fork 14
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
1 changed file
with
54 additions
and
0 deletions.
There are no files selected for viewing
54 changes: 54 additions & 0 deletions
54
lms/migrations/versions/2f05ff66ec2e_courseroster_table.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,54 @@ | ||
"""CourseRoster table.""" | ||
|
||
import sqlalchemy as sa | ||
from alembic import op | ||
|
||
revision = "2f05ff66ec2e" | ||
down_revision = "b97080de93bc" | ||
|
||
|
||
def upgrade() -> None: | ||
# ### commands auto generated by Alembic - please adjust! ### | ||
op.create_table( | ||
"course_roster", | ||
sa.Column("id", sa.Integer(), autoincrement=True, nullable=False), | ||
sa.Column("lms_course_id", sa.Integer(), nullable=False), | ||
sa.Column("lms_user_id", sa.Integer(), nullable=False), | ||
sa.Column("lti_role_id", sa.Integer(), nullable=False), | ||
sa.Column("active", sa.Boolean(), nullable=False), | ||
sa.Column( | ||
"created", sa.DateTime(), server_default=sa.text("now()"), nullable=False | ||
), | ||
sa.Column( | ||
"updated", sa.DateTime(), server_default=sa.text("now()"), nullable=False | ||
), | ||
sa.ForeignKeyConstraint( | ||
["lms_course_id"], | ||
["lms_course.id"], | ||
name=op.f("fk__course_roster__lms_course_id__lms_course"), | ||
ondelete="cascade", | ||
), | ||
sa.ForeignKeyConstraint( | ||
["lms_user_id"], | ||
["lms_user.id"], | ||
name=op.f("fk__course_roster__lms_user_id__lms_user"), | ||
ondelete="cascade", | ||
), | ||
sa.ForeignKeyConstraint( | ||
["lti_role_id"], | ||
["lti_role.id"], | ||
name=op.f("fk__course_roster__lti_role_id__lti_role"), | ||
ondelete="cascade", | ||
), | ||
sa.PrimaryKeyConstraint("id", name=op.f("pk__course_roster")), | ||
sa.UniqueConstraint( | ||
"lms_course_id", | ||
"lms_user_id", | ||
"lti_role_id", | ||
name=op.f("uq__course_roster__lms_course_id"), | ||
), | ||
) | ||
|
||
|
||
def downgrade() -> None: | ||
op.drop_table("course_roster") |