"""add usage table

迁移 ID: f55e998a17fa
父迁移:
创建时间: 2025-07-08 02:11:09.923575

"""

from __future__ import annotations

from collections.abc import Sequence

import sqlalchemy as sa
from alembic import op

revision: str = "f55e998a17fa"
down_revision: str | Sequence[str] | None = "9dd95c5e9b4d"
branch_labels: str | Sequence[str] | None = None
depends_on: str | Sequence[str] | None = ("muicebot",)


def upgrade(name: str = "") -> None:
    if name:
        return
    # ### commands auto generated by Alembic - please adjust! ###
    op.create_table(
        "muicebot_usage",
        sa.Column("id", sa.Integer(), autoincrement=True, nullable=False),
        sa.Column("plugin", sa.String(), nullable=False),
        sa.Column("type", sa.String(), nullable=False),
        sa.Column("date", sa.String(), nullable=False),
        sa.Column("tokens", sa.Integer(), nullable=True, default=0),
        sa.PrimaryKeyConstraint("id", name=op.f("pk_muicebot_usage")),
        info={"bind_key": "muicebot"},
    )
    # ### end Alembic commands ###


def downgrade(name: str = "") -> None:
    if name:
        return
    # ### commands auto generated by Alembic - please adjust! ###
    op.drop_table("muicebot_usage")
    # ### end Alembic commands ###
