"""add_ai_provider_config

Revision ID: b5dbd2bb5988
Revises: e786650ede6f
Create Date: 2026-07-08 19:52:21.424072
"""
from typing import Sequence, Union
from alembic import op
import sqlalchemy as sa


revision: str = 'b5dbd2bb5988'
down_revision: Union[str, None] = 'e786650ede6f'
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('ai_provider_config',
    sa.Column('id', sa.Uuid(), nullable=False),
    sa.Column('provider', sa.String(length=50), nullable=False, comment='deepseek/openai/claude'),
    sa.Column('api_key', sa.String(length=500), nullable=False),
    sa.Column('base_url', sa.String(length=500), nullable=False),
    sa.Column('model_name', sa.String(length=100), nullable=False),
    sa.Column('temperature', sa.Integer(), nullable=False),
    sa.Column('is_active', sa.Boolean(), nullable=False),
    sa.Column('updated_by', sa.Uuid(), nullable=True),
    sa.Column('created_at', sa.DateTime(timezone=True), server_default=sa.text('now()'), nullable=False),
    sa.Column('updated_at', sa.DateTime(timezone=True), server_default=sa.text('now()'), nullable=False),
    sa.ForeignKeyConstraint(['updated_by'], ['users.id'], ondelete='SET NULL'),
    sa.PrimaryKeyConstraint('id')
    )
    # ### end Alembic commands ###


def downgrade() -> None:
    # ### commands auto generated by Alembic - please adjust! ###
    op.drop_table('ai_provider_config')
    # ### end Alembic commands ###
