"""app_state (admin-controlled global flags)

Revision ID: 0006_app_state
Revises: 0005_shorts_probed
Create Date: 2026-06-11
"""
from typing import Sequence, Union

from alembic import op
import sqlalchemy as sa

revision: str = "0006_app_state"
down_revision: Union[str, None] = "0005_shorts_probed"
branch_labels: Union[str, Sequence[str], None] = None
depends_on: Union[str, Sequence[str], None] = None


def upgrade() -> None:
    op.create_table(
        "app_state",
        sa.Column("id", sa.Integer(), primary_key=True),
        sa.Column("sync_paused", sa.Boolean(), nullable=False, server_default="false"),
    )
    op.execute("INSERT INTO app_state (id, sync_paused) VALUES (1, false)")


def downgrade() -> None:
    op.drop_table("app_state")
