ScoDoc/migrations/versions/a57a6ee2e3cb_cascade_evaluation_poids.py

73 lines
1.8 KiB
Python

"""cascade evaluation/poids
Revision ID: a57a6ee2e3cb
Revises: 730ac71eea23
Create Date: 2021-12-13 23:39:37.586952
"""
from alembic import op
import sqlalchemy as sa
# revision identifiers, used by Alembic.
revision = "a57a6ee2e3cb"
down_revision = "730ac71eea23"
branch_labels = None
depends_on = None
def upgrade():
# ### commands auto generated by Alembic - please adjust! ###
op.drop_constraint(
"evaluation_ue_poids_ue_id_fkey", "evaluation_ue_poids", type_="foreignkey"
)
op.drop_constraint(
"evaluation_ue_poids_evaluation_id_fkey",
"evaluation_ue_poids",
type_="foreignkey",
)
op.create_foreign_key(
"evaluation_ue_poids_evaluation_id_fkey",
"evaluation_ue_poids",
"notes_evaluation",
["evaluation_id"],
["id"],
ondelete="CASCADE",
)
op.create_foreign_key(
"evaluation_ue_poids_ue_id_fkey",
"evaluation_ue_poids",
"notes_ue",
["ue_id"],
["id"],
ondelete="CASCADE",
)
# ### end Alembic commands ###
def downgrade():
# ### commands auto generated by Alembic - please adjust! ###
op.drop_constraint(
"evaluation_ue_poids_evaluation_id_fkey",
"evaluation_ue_poids",
type_="foreignkey",
)
op.drop_constraint(
"evaluation_ue_poids_ue_id_fkey", "evaluation_ue_poids", type_="foreignkey"
)
op.create_foreign_key(
"evaluation_ue_poids_evaluation_id_fkey",
"evaluation_ue_poids",
"notes_evaluation",
["evaluation_id"],
["id"],
)
op.create_foreign_key(
"evaluation_ue_poids_ue_id_fkey",
"evaluation_ue_poids",
"notes_ue",
["ue_id"],
["id"],
)
# ### end Alembic commands ###