"""add neb nextchain subtask

Revision ID: 8c781020aed4
Revises: ee6defa818d6
Create Date: 2023-01-19 20:48:18.953059

"""

import sqlalchemy as sa
from alembic import op

# revision identifiers, used by Alembic.
revision = "8c781020aed4"
down_revision = "ee6defa818d6"
branch_labels = None
depends_on = None


def upgrade():
    # ### commands auto generated by Alembic - please adjust! ###
    op.create_table(
        "neb_subtasks",
        sa.Column("neb_id", sa.Integer(), nullable=False),
        sa.Column("subtask_id", sa.Integer(), nullable=False),
        sa.Column("chain_iteration", sa.Integer(), nullable=False),
        sa.ForeignKeyConstraint(["neb_id"], ["neb_record.id"], ondelete="cascade"),
        sa.ForeignKeyConstraint(
            ["subtask_id"],
            ["service_subtask_record.id"],
        ),
        sa.PrimaryKeyConstraint("neb_id", "subtask_id", "chain_iteration"),
    )
    # ### end Alembic commands ###


def downgrade():
    # ### commands auto generated by Alembic - please adjust! ###
    op.drop_table("neb_subtasks")
    # ### end Alembic commands ###
