ScoDoc-PE/migrations/versions/1efe07413835_added_cascade_on_absences_notifications.py

48 lines
1.1 KiB
Python

"""added cascade on absences_notifications
Revision ID: 1efe07413835
Revises: 75cf18659984
Create Date: 2021-11-09 11:49:31.739803
"""
from alembic import op
import sqlalchemy as sa
# revision identifiers, used by Alembic.
revision = "1efe07413835"
down_revision = "75cf18659984"
branch_labels = None
depends_on = None
def upgrade():
# ### commands auto generated by Alembic - please adjust! ###
op.drop_constraint(
"absences_notifications_formsemestre_id_fkey",
"absences_notifications",
type_="foreignkey",
)
op.create_foreign_key(
None,
"absences_notifications",
"notes_formsemestre",
["formsemestre_id"],
["id"],
ondelete="CASCADE",
)
# ### end Alembic commands ###
def downgrade():
# ### commands auto generated by Alembic - please adjust! ###
op.drop_constraint(None, "absences_notifications", type_="foreignkey")
op.create_foreign_key(
"absences_notifications_formsemestre_id_fkey",
"absences_notifications",
"notes_formsemestre",
["formsemestre_id"],
["id"],
)
# ### end Alembic commands ###