1
0
forked from ScoDoc/ScoDoc
ScoDoc-Front/migrations/versions/a217bf588f4c_scodoc_9_0_13_essai_cascade.py

60 lines
1.4 KiB
Python

"""ScoDoc 9.0.13: essai cascade
Revision ID: a217bf588f4c
Revises: f73251d1d825
Create Date: 2021-09-10 21:44:34.947317
"""
from alembic import op
import sqlalchemy as sa
# revision identifiers, used by Alembic.
revision = "a217bf588f4c"
down_revision = "f73251d1d825"
branch_labels = None
depends_on = None
def upgrade():
# ### commands auto generated by Alembic - please adjust! ###
op.alter_column(
"notes_semset_formsemestre",
"semset_id",
existing_type=sa.INTEGER(),
nullable=False,
)
op.drop_constraint(
"notes_semset_formsemestre_semset_id_fkey",
"notes_semset_formsemestre",
type_="foreignkey",
)
op.create_foreign_key(
None,
"notes_semset_formsemestre",
"notes_semset",
["semset_id"],
["id"],
ondelete="CASCADE",
)
# ### end Alembic commands ###
def downgrade():
# ### commands auto generated by Alembic - please adjust! ###
op.drop_constraint(None, "notes_semset_formsemestre", type_="foreignkey")
op.create_foreign_key(
"notes_semset_formsemestre_semset_id_fkey",
"notes_semset_formsemestre",
"notes_semset",
["semset_id"],
["id"],
)
op.alter_column(
"notes_semset_formsemestre",
"semset_id",
existing_type=sa.INTEGER(),
nullable=True,
)
# ### end Alembic commands ###