"""make_bgm_music_url_non_nullable

Revision ID: 7149f61a2f9c
Revises: 7172a476e5b2
Create Date: 2026-05-21 10:45:00.000000

"""
from typing import Sequence, Union

from alembic import op
import sqlalchemy as sa


# revision identifiers, used by Alembic.
revision: str = '7149f61a2f9c'
down_revision: Union[str, Sequence[str], None] = '100366516fbd'
branch_labels: Union[str, Sequence[str], None] = None
depends_on: Union[str, Sequence[str], None] = None


def upgrade() -> None:
    """Upgrade schema."""
    # BGM 云端化改造后，url 字段为必填（七牛云 CDN 地址）
    op.alter_column(
        'mjk_bgm_musics',
        'url',
        existing_type=sa.String(length=1024),
        nullable=False,
        comment='七牛云 URL',
    )


def downgrade() -> None:
    """Downgrade schema."""
    op.alter_column(
        'mjk_bgm_musics',
        'url',
        existing_type=sa.String(length=1024),
        nullable=True,
        comment='七牛云 URL',
    )
