"""add workflow_run_id to totp code model

Revision ID: 511d9da18f5d
Revises: 3aa168d1ffa5
Create Date: 2025-04-21 00:19:48.989020+00:00

"""

from typing import Sequence, Union

import sqlalchemy as sa

from alembic import op

# revision identifiers, used by Alembic.
revision: str = "511d9da18f5d"
down_revision: Union[str, None] = "3aa168d1ffa5"
branch_labels: Union[str, Sequence[str], None] = None
depends_on: Union[str, Sequence[str], None] = None


def upgrade() -> None:
    # ### commands auto generated by Alembic - please adjust! ###
    op.add_column("totp_codes", sa.Column("workflow_run_id", sa.String(), nullable=True))
    op.create_foreign_key(None, "totp_codes", "workflow_runs", ["workflow_run_id"], ["workflow_run_id"])
    # ### end Alembic commands ###


def downgrade() -> None:
    # ### commands auto generated by Alembic - please adjust! ###
    op.drop_constraint(None, "totp_codes", type_="foreignkey")
    op.drop_column("totp_codes", "workflow_run_id")
    # ### end Alembic commands ###
