"""Add hidden boolean flag to creators table.

Marks test/internal creators as hidden so they are filtered from
public API responses.

Revision ID: 009_add_creator_hidden_flag
Revises: 008_rename_processing_status
"""
from alembic import op
import sqlalchemy as sa

revision = "009_add_creator_hidden_flag"
down_revision = "008_rename_processing_status"
branch_labels = None
depends_on = None


def upgrade() -> None:
    op.add_column(
        "creators",
        sa.Column("hidden", sa.Boolean(), server_default="false", nullable=False),
    )
    # Mark known test creator as hidden
    op.execute("UPDATE creators SET hidden = true WHERE slug = 'testcreator'")


def downgrade() -> None:
    op.drop_column("creators", "hidden")
