"""fix data types

Revision ID: c08ae04dc482
Revises:
Create Date: 2024-05-18 16:24:31.152480+00:00

"""

from typing import Sequence

import sqlalchemy as sa

from alembic import op

# revision identifiers, used by Alembic.
revision: str = "c08ae04dc482"
down_revision: str | None = None
branch_labels: str | Sequence[str] | None = None
depends_on: str | Sequence[str] | None = None


def upgrade() -> None:
    # ### commands auto generated by Alembic - please adjust! ###
    with op.batch_alter_table("ratings", schema=None) as batch_op:
        batch_op.alter_column(
            "score",
            existing_type=sa.NUMERIC(),
            type_=sa.Integer(),
            existing_nullable=False,
        )
        batch_op.alter_column(
            "favorite",
            existing_type=sa.NUMERIC(),
            type_=sa.Integer(),
            existing_nullable=True,
        )
        batch_op.alter_column(
            "finished",
            existing_type=sa.NUMERIC(),
            type_=sa.Integer(),
            existing_nullable=True,
        )

    # ### end Alembic commands ###


def downgrade() -> None:
    # ### commands auto generated by Alembic - please adjust! ###
    with op.batch_alter_table("ratings", schema=None) as batch_op:
        batch_op.alter_column(
            "finished",
            existing_type=sa.Integer(),
            type_=sa.NUMERIC(),
            existing_nullable=True,
        )
        batch_op.alter_column(
            "favorite",
            existing_type=sa.Integer(),
            type_=sa.NUMERIC(),
            existing_nullable=True,
        )
        batch_op.alter_column(
            "score",
            existing_type=sa.Integer(),
            type_=sa.NUMERIC(),
            existing_nullable=False,
        )

    # ### end Alembic commands ###
