MonScoDocEssai/migrations/versions/a26b3103697d_fix_cascades_on_moduleuecoef.py

65 lines
1.6 KiB
Python
Raw Normal View History

2021-11-30 10:54:12 +01:00
"""fix cascades on ModuleUECoef
Revision ID: a26b3103697d
Revises: c8efc54586d8
Create Date: 2021-11-30 10:47:23.465897
"""
from alembic import op
import sqlalchemy as sa
# revision identifiers, used by Alembic.
revision = "a26b3103697d"
down_revision = "c8efc54586d8"
branch_labels = None
depends_on = None
def upgrade():
# ### commands auto generated by Alembic - please adjust! ###
op.drop_constraint(
"module_ue_coef_module_id_fkey", "module_ue_coef", type_="foreignkey"
)
op.drop_constraint(
"module_ue_coef_ue_id_fkey", "module_ue_coef", type_="foreignkey"
)
op.create_foreign_key(
"ev_module_ue_coef_ue_id_fkey",
"module_ue_coef",
"notes_modules",
["module_id"],
["id"],
ondelete="CASCADE",
)
op.create_foreign_key(
"ev_module_ue_coef_module_id_fkey",
"module_ue_coef",
"notes_ue",
["ue_id"],
["id"],
ondelete="CASCADE",
)
# ### end Alembic commands ###
def downgrade():
# ### commands auto generated by Alembic - please adjust! ###
op.drop_constraint(
"ev_module_ue_coef_ue_id_fkey", "module_ue_coef", type_="foreignkey"
)
op.drop_constraint(
"ev_module_ue_coef_module_id_fkey", "module_ue_coef", type_="foreignkey"
)
op.create_foreign_key(
"module_ue_coef_ue_id_fkey", "module_ue_coef", "notes_ue", ["ue_id"], ["id"]
)
op.create_foreign_key(
"module_ue_coef_module_id_fkey",
"module_ue_coef",
"notes_modules",
["module_id"],
["id"],
)
# ### end Alembic commands ###