"""add openai image token columns to api_calls

Revision ID: a205678752dc
Revises: 0426endpointrefactor
Create Date: 2026-04-29 17:43:20.195173

"""

from collections.abc import Sequence

import sqlalchemy as sa

from alembic import op

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


def upgrade() -> None:
    """Upgrade schema."""
    # ### commands auto generated by Alembic - please adjust! ###
    with op.batch_alter_table("api_calls", schema=None) as batch_op:
        batch_op.add_column(sa.Column("image_input_tokens", sa.Integer(), nullable=True))
        batch_op.add_column(sa.Column("image_output_tokens", sa.Integer(), nullable=True))
        batch_op.add_column(sa.Column("text_input_tokens", sa.Integer(), nullable=True))
        batch_op.add_column(sa.Column("text_output_tokens", sa.Integer(), nullable=True))

    # ### end Alembic commands ###


def downgrade() -> None:
    """Downgrade schema."""
    # ### commands auto generated by Alembic - please adjust! ###
    with op.batch_alter_table("api_calls", schema=None) as batch_op:
        batch_op.drop_column("text_output_tokens")
        batch_op.drop_column("text_input_tokens")
        batch_op.drop_column("image_output_tokens")
        batch_op.drop_column("image_input_tokens")

    # ### end Alembic commands ###
