"""job id in history run

Revision ID: c90a7c76e996
Revises: f37aceb45062
Create Date: 2025-04-16 10:44:30.219309

"""
import sqlalchemy as sa
from alembic import op


# revision identifiers, used by Alembic.
revision = "c90a7c76e996"
down_revision = "f37aceb45062"
branch_labels = None
depends_on = None


def upgrade() -> None:
    # ### commands auto generated by Alembic - please adjust! ###
    with op.batch_alter_table("historyrun", schema=None) as batch_op:
        batch_op.add_column(sa.Column("job_id", sa.Integer(), nullable=False))
        batch_op.create_foreign_key(
            batch_op.f("fk_historyrun_job_id_jobv2"),
            "jobv2",
            ["job_id"],
            ["id"],
        )

    # ### end Alembic commands ###


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

    # ### end Alembic commands ###
