"""Add ml_model_version table

Revision ID: 004
Revises: 003
Create Date: 2026-04-23 15:00:00.000000

"""
from typing import Sequence, Union

from alembic import op
import sqlalchemy as sa

# revision identifiers, used by Alembic.
revision: str = "004"
down_revision: Union[str, None] = "003"
branch_labels: Union[str, Sequence[str], None] = None
depends_on: Union[str, Sequence[str], None] = None


def upgrade() -> None:
    op.create_table(
        "ml_model_version",
        sa.Column("id", sa.Integer(), primary_key=True, index=True),
        sa.Column("name", sa.String(100), nullable=False),
        sa.Column("model_path", sa.String(500), nullable=False),
        sa.Column("vectorizer_path", sa.String(500), nullable=False),
        sa.Column("accuracy", sa.Float(), default=0.0),
        sa.Column("train_samples", sa.Integer(), default=0),
        sa.Column("train_date", sa.DateTime(), default=sa.func.now()),
        sa.Column("is_active", sa.Boolean(), default=False),
        sa.Column("description", sa.Text(), nullable=True),
        sa.Column("created_at", sa.DateTime(), default=sa.func.now()),
    )


def downgrade() -> None:
    op.drop_table("ml_model_version")
