"""Remove stale MANUAL scan rows + drop MANUAL from python enum

Revision ID: 021
Revises: 020
Create Date: 2026-05-19 18:00:00.000000

ScanType.MANUAL was only written by the removed 'New Scan' stub
button (commit 8a82158). Nothing writes MANUAL anymore. Cleans up
leftover stub rows from the scans table so the Scan Jobs page only
shows source-labelled entries (wazuh / nessus).

The Postgres enum value 'MANUAL' stays in the type — Postgres has
no clean DROP VALUE for enums and the value is harmless when unused.
The Python ScanType enum already had MANUAL removed in the same
commit as this migration.

Idempotent — second run finds no MANUAL rows.
"""
from alembic import op


revision = '021'
down_revision = '020'
branch_labels = None
depends_on = None


def upgrade() -> None:
    op.execute("DELETE FROM scans WHERE scan_type = 'MANUAL'")


def downgrade() -> None:
    # Deleted rows cannot be recovered; no-op.
    pass
