"""make meeting room_id required and add foreign key

Revision ID: 6dec9fb5b46c
Revises: 61882a919591
Create Date: 2025-09-10 10:47:06.006819

"""

from typing import Sequence, Union

from alembic import op

# revision identifiers, used by Alembic.
revision: str = "6dec9fb5b46c"
down_revision: Union[str, None] = "61882a919591"
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", schema=None) as batch_op:
        batch_op.create_foreign_key(
            None, "room", ["room_id"], ["id"], ondelete="CASCADE"
        )

    # ### end Alembic commands ###


def downgrade() -> None:
    # ### commands auto generated by Alembic - please adjust! ###
    with op.batch_alter_table("meeting", schema=None) as batch_op:
        batch_op.drop_constraint("meeting_room_id_fkey", type_="foreignkey")

    # ### end Alembic commands ###
