"""media_assets.gc_notified flag for one-shot pre-expiry warnings

Revision ID: 0038_asset_gc_notified
Revises: 0037_dl_builtin_profiles
Create Date: 2026-07-03

The download GC warns each holder once, a grace window before an asset's TTL expiry; this flag
records that so subsequent GC runs don't re-notify until the asset is deleted.
"""
from typing import Sequence, Union

import sqlalchemy as sa
from alembic import op

revision: str = "0038_asset_gc_notified"
down_revision: Union[str, None] = "0037_dl_builtin_profiles"
branch_labels: Union[str, Sequence[str], None] = None
depends_on: Union[str, Sequence[str], None] = None


def upgrade() -> None:
    op.add_column(
        "media_assets",
        sa.Column("gc_notified", sa.Boolean(), server_default="false", nullable=False),
    )


def downgrade() -> None:
    op.drop_column("media_assets", "gc_notified")
