"""add secret_value column to parameters

Revision ID: a2bfaf2e8406
Revises: 24bd81ed7dad
Create Date: 2024-07-25 11:43:52.547883

"""
from typing import Sequence, Union

from alembic import op
import sqlalchemy as sa


# revision identifiers, used by Alembic.
revision: str = 'a2bfaf2e8406'
down_revision: Union[str, None] = '24bd81ed7dad'
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('parameters', sa.Column('secret_value', sa.LargeBinary(), nullable=True))
    op.alter_column('runs', 'return_code',
               existing_type=sa.INTEGER(),
               nullable=False)
    op.alter_column('runs', 'message',
               existing_type=sa.VARCHAR(),
               nullable=False)
    op.alter_column('runs', 'parent_run',
               existing_type=sa.VARCHAR(),
               nullable=False)
    # ### end Alembic commands ###


def downgrade() -> None:
    # ### commands auto generated by Alembic - please adjust! ###
    op.alter_column('runs', 'parent_run',
               existing_type=sa.VARCHAR(),
               nullable=True)
    op.alter_column('runs', 'message',
               existing_type=sa.VARCHAR(),
               nullable=True)
    op.alter_column('runs', 'return_code',
               existing_type=sa.INTEGER(),
               nullable=True)
    op.drop_column('parameters', 'secret_value')
    # ### end Alembic commands ###
