ScoDoc/migrations/versions/f95656fdd3ef_dispenseue.py

44 lines
1.3 KiB
Python
Raw Permalink Normal View History

"""DispenseUE
Revision ID: f95656fdd3ef
Revises: 5542cac8c34a
Create Date: 2022-11-30 22:22:05.045255
"""
from alembic import op
import sqlalchemy as sa
# revision identifiers, used by Alembic.
revision = "f95656fdd3ef"
down_revision = "5542cac8c34a"
branch_labels = None
depends_on = None
def upgrade():
# ### commands auto generated by Alembic - please adjust! ###
op.create_table(
"dispenseUE",
sa.Column("id", sa.Integer(), nullable=False),
sa.Column("ue_id", sa.Integer(), nullable=False),
sa.Column("etudid", sa.Integer(), nullable=False),
sa.ForeignKeyConstraint(["etudid"], ["identite.id"], ondelete="CASCADE"),
sa.ForeignKeyConstraint(["ue_id"], ["notes_ue.id"], ondelete="CASCADE"),
sa.PrimaryKeyConstraint("id"),
sa.UniqueConstraint("ue_id", "etudid"),
)
op.create_index(
op.f("ix_dispenseUE_etudid"), "dispenseUE", ["etudid"], unique=False
)
op.create_index(op.f("ix_dispenseUE_ue_id"), "dispenseUE", ["ue_id"], unique=False)
# ### end Alembic commands ###
def downgrade():
# ### commands auto generated by Alembic - please adjust! ###
op.drop_index(op.f("ix_dispenseUE_ue_id"), table_name="dispenseUE")
op.drop_index(op.f("ix_dispenseUE_etudid"), table_name="dispenseUE")
op.drop_table("dispenseUE")
# ### end Alembic commands ###