ScoDoc/migrations/versions/6520faf67508_fix_cascade_abs_mod.py

44 lines
1.0 KiB
Python
Raw Permalink Normal View History

2023-03-15 19:13:45 +01:00
"""fix_cascade_abs_mod
Revision ID: 6520faf67508
Revises: 19a608ebc9b7
Create Date: 2023-03-15 19:07:15.152610
"""
from alembic import op
import sqlalchemy as sa
# revision identifiers, used by Alembic.
revision = "6520faf67508"
down_revision = "19a608ebc9b7"
branch_labels = None
depends_on = None
def upgrade():
# ### commands auto generated by Alembic - please adjust! ###
op.drop_constraint("absences_moduleimpl_id_fkey", "absences", type_="foreignkey")
op.create_foreign_key(
"absences_moduleimpl_id_fkey",
"absences",
"notes_moduleimpl",
["moduleimpl_id"],
["id"],
ondelete="SET NULL",
)
# ### end Alembic commands ###
def downgrade():
# ### commands auto generated by Alembic - please adjust! ###
op.drop_constraint("absences_moduleimpl_id_fkey", "absences", type_="foreignkey")
op.create_foreign_key(
"absences_moduleimpl_id_fkey",
"absences",
"notes_moduleimpl",
["moduleimpl_id"],
["id"],
)
# ### end Alembic commands ###