1
0
forked from ScoDoc/ScoDoc
ScoDoc/migrations/versions/39818df276aa_cascades_sur_itemsuivi.py

67 lines
1.6 KiB
Python

"""cascades sur itemsuivi
Revision ID: 39818df276aa
Revises: 1efe07413835
Create Date: 2021-11-27 19:03:09.329065
"""
from alembic import op
import sqlalchemy as sa
# revision identifiers, used by Alembic.
revision = "39818df276aa"
down_revision = "1efe07413835"
branch_labels = None
depends_on = None
def upgrade():
# ### commands auto generated by Alembic - please adjust! ###
op.drop_constraint(
"itemsuivi_tags_assoc_tag_id_fkey", "itemsuivi_tags_assoc", type_="foreignkey"
)
op.drop_constraint(
"itemsuivi_tags_assoc_itemsuivi_id_fkey",
"itemsuivi_tags_assoc",
type_="foreignkey",
)
op.create_foreign_key(
None,
"itemsuivi_tags_assoc",
"itemsuivi",
["itemsuivi_id"],
["id"],
ondelete="CASCADE",
)
op.create_foreign_key(
None,
"itemsuivi_tags_assoc",
"itemsuivi_tags",
["tag_id"],
["id"],
ondelete="CASCADE",
)
# ### end Alembic commands ###
def downgrade():
# ### commands auto generated by Alembic - please adjust! ###
op.drop_constraint(None, "itemsuivi_tags_assoc", type_="foreignkey")
op.drop_constraint(None, "itemsuivi_tags_assoc", type_="foreignkey")
op.create_foreign_key(
"itemsuivi_tags_assoc_itemsuivi_id_fkey",
"itemsuivi_tags_assoc",
"itemsuivi",
["itemsuivi_id"],
["id"],
)
op.create_foreign_key(
"itemsuivi_tags_assoc_tag_id_fkey",
"itemsuivi_tags_assoc",
"itemsuivi_tags",
["tag_id"],
["id"],
)
# ### end Alembic commands ###