"""create assets table

Revision ID: d67efd76058f
Revises: 548f6ca3e91c
Create Date: 2026-04-15 20:17:40.585453

"""

from collections.abc import Sequence

import sqlalchemy as sa

from alembic import op

# revision identifiers, used by Alembic.
revision: str = "d67efd76058f"
down_revision: str | Sequence[str] | None = "548f6ca3e91c"
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! ###
    op.create_table(
        "assets",
        sa.Column("id", sa.String(length=36), nullable=False),
        sa.Column("type", sa.String(length=32), nullable=False),
        sa.Column("name", sa.String(length=200), nullable=False),
        sa.Column("description", sa.Text(), nullable=False),
        sa.Column("voice_style", sa.Text(), nullable=False),
        sa.Column("image_path", sa.String(length=500), nullable=True),
        sa.Column("source_project", sa.String(length=200), nullable=True),
        sa.Column("created_at", sa.DateTime(timezone=True), nullable=False),
        sa.Column("updated_at", sa.DateTime(timezone=True), nullable=False),
        sa.PrimaryKeyConstraint("id"),
        sa.UniqueConstraint("type", "name", name="uq_asset_type_name"),
    )
    with op.batch_alter_table("assets", schema=None) as batch_op:
        batch_op.create_index("ix_asset_name", ["name"], unique=False)
        batch_op.create_index("ix_asset_type", ["type"], unique=False)

    # ### end Alembic commands ###


def downgrade() -> None:
    """Downgrade schema."""
    # ### commands auto generated by Alembic - please adjust! ###
    with op.batch_alter_table("assets", schema=None) as batch_op:
        batch_op.drop_index("ix_asset_type")
        batch_op.drop_index("ix_asset_name")

    op.drop_table("assets")
    # ### end Alembic commands ###
