"""add job_progress table for tracking job submission state

Revision ID: 31382ad313d1
Revises: 99c3877d0f10
Create Date: 2025-03-25 17:38:11.047745

"""
import sqlalchemy as sa

from alembic import op

# revision identifiers, used by Alembic.
revision = "31382ad313d1"
down_revision = "99c3877d0f10"
branch_labels = None
depends_on = None


def upgrade():
    # ### commands auto generated by Alembic - please adjust! ###
    op.create_table(
        "job_progresses",
        sa.Column("id", sa.Integer(), autoincrement=True, nullable=False),
        sa.Column("job_submission_id", sa.Integer(), nullable=False),
        sa.Column("timestamp", sa.DateTime(timezone=True), nullable=False),
        sa.Column("slurm_job_state", sa.String(), nullable=True),
        sa.Column("additional_info", sa.String(), nullable=True),
        sa.ForeignKeyConstraint(
            ["job_submission_id"], ["job_submissions.id"], ondelete="CASCADE"
        ),
        sa.PrimaryKeyConstraint("id"),
    )
    # ### end Alembic commands ###


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