"""Make resource_id FK non-nullable

Revision ID: 45fbb391d7af
Revises: caba9fb1ea5e
Create Date: 2025-11-11 16:39:12.813766

"""

import sqlalchemy as sa
from alembic import op

# revision identifiers, used by Alembic.
revision = "45fbb391d7af"
down_revision = "caba9fb1ea5e"
branch_labels = None
depends_on = None


def upgrade() -> None:
    # ### commands auto generated by Alembic - please adjust! ###
    with op.batch_alter_table("projectv2", schema=None) as batch_op:
        batch_op.alter_column(
            "resource_id", existing_type=sa.INTEGER(), nullable=False
        )

    with op.batch_alter_table("taskgroupv2", schema=None) as batch_op:
        batch_op.alter_column(
            "resource_id", existing_type=sa.INTEGER(), nullable=False
        )

    # ### end Alembic commands ###


def downgrade() -> None:
    # ### commands auto generated by Alembic - please adjust! ###
    with op.batch_alter_table("taskgroupv2", schema=None) as batch_op:
        batch_op.alter_column(
            "resource_id", existing_type=sa.INTEGER(), nullable=True
        )

    with op.batch_alter_table("projectv2", schema=None) as batch_op:
        batch_op.alter_column(
            "resource_id", existing_type=sa.INTEGER(), nullable=True
        )

    # ### end Alembic commands ###
