"""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 ###