"""add cascade delete to meeting consent foreign key

Revision ID: 5a8907fd1d78
Revises: 0ab2d7ffaa16
Create Date: 2025-08-26 17:26:50.945491

"""

from typing import Sequence, Union

from alembic import op

# revision identifiers, used by Alembic.
revision: str = "5a8907fd1d78"
down_revision: Union[str, None] = "0ab2d7ffaa16"
branch_labels: Union[str, Sequence[str], None] = None
depends_on: Union[str, Sequence[str], None] = None


def upgrade() -> None:
    # ### commands auto generated by Alembic - please adjust! ###
    with op.batch_alter_table("meeting_consent", schema=None) as batch_op:
        batch_op.drop_constraint(
            batch_op.f("meeting_consent_meeting_id_fkey"), type_="foreignkey"
        )
        batch_op.create_foreign_key(
            batch_op.f("meeting_consent_meeting_id_fkey"),
            "meeting",
            ["meeting_id"],
            ["id"],
            ondelete="CASCADE",
        )

    # ### end Alembic commands ###


def downgrade() -> None:
    # ### commands auto generated by Alembic - please adjust! ###
    with op.batch_alter_table("meeting_consent", schema=None) as batch_op:
        batch_op.drop_constraint(
            batch_op.f("meeting_consent_meeting_id_fkey"), type_="foreignkey"
        )
        batch_op.create_foreign_key(
            batch_op.f("meeting_consent_meeting_id_fkey"),
            "meeting",
            ["meeting_id"],
            ["id"],
        )

    # ### end Alembic commands ###
