"""Add llm_configs table

Revision ID: 882af51512ff
Revises: 2498205b9e48
Create Date: 2025-10-04 13:13:07.498772

"""
from typing import Sequence, Union

from alembic import op
import sqlalchemy as sa


# revision identifiers, used by Alembic.
revision: str = '882af51512ff'
down_revision: Union[str, None] = '2498205b9e48'
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.create_table('llm_configs',
    sa.Column('id', sa.Integer(), nullable=False),
    sa.Column('openrouter_api_key', sa.String(), nullable=True),
    sa.Column('preferred_model', sa.String(), nullable=True),
    sa.PrimaryKeyConstraint('id')
    )
    op.create_index(op.f('ix_llm_configs_id'), 'llm_configs', ['id'], unique=False)
    op.drop_table('_litestream_seq')
    op.drop_table('_litestream_lock')
    op.drop_column('tracked_meals', 'quantity')
    # ### end Alembic commands ###


def downgrade() -> None:
    # ### commands auto generated by Alembic - please adjust! ###
    op.add_column('tracked_meals', sa.Column('quantity', sa.FLOAT(), nullable=True))
    op.create_table('_litestream_lock',
    sa.Column('id', sa.INTEGER(), nullable=True)
    )
    op.create_table('_litestream_seq',
    sa.Column('id', sa.INTEGER(), nullable=True),
    sa.Column('seq', sa.INTEGER(), nullable=True),
    sa.PrimaryKeyConstraint('id')
    )
    op.drop_index(op.f('ix_llm_configs_id'), table_name='llm_configs')
    op.drop_table('llm_configs')
    # ### end Alembic commands ###
