"""add song alias table

迁移 ID: 09e00213edc6
父迁移: fb6275585c59
创建时间: 2025-11-18 19:02:31.825086

"""

from __future__ import annotations

from collections.abc import Sequence

import sqlalchemy as sa
from alembic import op

revision: str = "09e00213edc6"
down_revision: str | Sequence[str] | None = "fb6275585c59"
branch_labels: str | Sequence[str] | None = None
depends_on: str | Sequence[str] | None = None


def upgrade(name: str = "") -> None:
    if name:
        return
    # ### commands auto generated by Alembic - please adjust! ###
    op.create_table(
        "nonebot_plugin_rikka_maisongalias",
        sa.Column("song_id", sa.Integer(), nullable=False),
        sa.Column("alias", sa.String(), nullable=True),
        sa.Column("custom_alias", sa.String(), nullable=True),
        sa.ForeignKeyConstraint(
            ["song_id"],
            ["nonebot_plugin_rikka_maisong.id"],
            name=op.f("fk_nonebot_plugin_rikka_maisongalias_song_id_nonebot_plugin_rikka_maisong"),
        ),
        sa.PrimaryKeyConstraint("song_id", name=op.f("pk_nonebot_plugin_rikka_maisongalias")),
        info={"bind_key": "nonebot_plugin_rikka"},
    )
    # ### end Alembic commands ###


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