"""add_bgm_music_table

Revision ID: 7172a476e5b2
Revises: d8f4912d7a52
Create Date: 2026-05-23 13:56:46.013156

"""
from typing import Sequence, Union

from alembic import op
import sqlalchemy as sa


# revision identifiers, used by Alembic.
revision: str = '7172a476e5b2'
down_revision: Union[str, Sequence[str], None] = 'd8f4912d7a52'
branch_labels: Union[str, Sequence[str], None] = None
depends_on: Union[str, Sequence[str], None] = None


def upgrade() -> None:
    """Upgrade schema."""
    # ### commands auto generated by Alembic - please adjust! ###
    op.create_table('mjk_bgm_musics',
    sa.Column('title', sa.String(length=255), nullable=False, comment='音乐名称'),
    sa.Column('artist', sa.String(length=255), nullable=True, comment='艺术家'),
    sa.Column('category', sa.String(length=32), nullable=False, comment='场景分类'),
    sa.Column('file_path', sa.String(length=512), nullable=False, comment='相对文件路径'),
    sa.Column('duration', sa.Float(), nullable=True, comment='时长（秒）'),
    sa.Column('status', sa.String(length=16), nullable=False, comment='状态: active/inactive'),
    sa.Column('sort_order', sa.Integer(), nullable=False, comment='排序权重'),
    sa.Column('id', sa.BigInteger(), autoincrement=True, nullable=False),
    sa.Column('created_at', sa.DateTime(timezone=True), nullable=False),
    sa.Column('updated_at', sa.DateTime(timezone=True), nullable=False),
    sa.PrimaryKeyConstraint('id')
    )
    op.create_index(op.f('ix_mjk_bgm_musics_category'), 'mjk_bgm_musics', ['category'], unique=False)
    # ### end Alembic commands ###


def downgrade() -> None:
    """Downgrade schema."""
    # ### commands auto generated by Alembic - please adjust! ###
    op.drop_index(op.f('ix_mjk_bgm_musics_category'), table_name='mjk_bgm_musics')
    op.drop_table('mjk_bgm_musics')
    # ### end Alembic commands ###
