"""add card_keys.card_type and points_amount

Revision ID: 015
Revises: 014
Create Date: 2026-05-22

"""

from typing import Sequence, Union

import sqlalchemy as sa
from alembic import op

revision: str = "015"
down_revision: Union[str, None] = "014"
branch_labels: Union[str, Sequence[str], None] = None
depends_on: Union[str, Sequence[str], None] = None


def upgrade() -> None:
    op.add_column(
        "card_keys",
        sa.Column(
            "card_type",
            sa.String(length=16),
            nullable=False,
            server_default="时长",
        ),
    )
    op.add_column(
        "card_keys",
        sa.Column("points_amount", sa.Float(), nullable=True),
    )


def downgrade() -> None:
    op.drop_column("card_keys", "points_amount")
    op.drop_column("card_keys", "card_type")
