# type: ignore
"""Make Scalar.unit non-optional

Revision ID: d66a8276ba0a
Revises: 914991d09f59
Create Date: 2024-11-29 14:14:42.857695

"""

import sqlalchemy as sa
from alembic import op

# Revision identifiers, used by Alembic.
revision = "d66a8276ba0a"
down_revision = "914991d09f59"
branch_labels = None
depends_on = None


def upgrade():
    # ### commands auto generated by Alembic - please adjust! ###
    with op.batch_alter_table("optimization_scalar", schema=None) as batch_op:
        batch_op.alter_column("unit__id", existing_type=sa.INTEGER(), nullable=False)

    with op.batch_alter_table("runmetaentry", schema=None) as batch_op:
        batch_op.alter_column(
            "type",
            new_column_name="dtype",
        )

    # ### end Alembic commands ###


def downgrade():
    # ### commands auto generated by Alembic - please adjust! ###
    with op.batch_alter_table("runmetaentry", schema=None) as batch_op:
        batch_op.alter_column(
            "dtype",
            new_column_name="type",
        )

    with op.batch_alter_table("optimization_scalar", schema=None) as batch_op:
        batch_op.alter_column("unit__id", existing_type=sa.INTEGER(), nullable=True)

    # ### end Alembic commands ###
