"""Remove on delete cascade for ProductionScheduleVersion.production_schedule_from

Revision ID: e8bc24998b34
Revises: 4368137b44e1
Create Date: 2025-07-24 14:37:53.406897

"""

from alembic import op


# revision identifiers, used by Alembic.
revision = "e8bc24998b34"
down_revision = "4368137b44e1"
branch_labels = None
depends_on = None


def upgrade():
    # ### commands auto generated by Alembic - please adjust! ###
    with op.batch_alter_table(
        "production_schedule_version", schema=None
    ) as batch_op:
        batch_op.drop_constraint(
            batch_op.f(
                "production_schedule_version_production_schedule_from_fkey"
            ),
            type_="foreignkey",
        )
        batch_op.create_foreign_key(
            None,
            "production_schedule_version",
            ["production_schedule_from"],
            ["id"],
        )

    # ### end Alembic commands ###


def downgrade():
    # ### commands auto generated by Alembic - please adjust! ###
    with op.batch_alter_table(
        "production_schedule_version", schema=None
    ) as batch_op:
        batch_op.drop_constraint(
            "production_schedule_version_production_schedule_from_fkey",
            type_="foreignkey",
        )
        batch_op.create_foreign_key(
            batch_op.f(
                "production_schedule_version_production_schedule_from_fkey"
            ),
            "production_schedule_version",
            ["production_schedule_from"],
            ["id"],
            ondelete="CASCADE",
        )

    # ### end Alembic commands ###
