"""Fix scans.scan_type enum — SQLAlchemy emits uppercase ScanType.NESSUS

Revision ID: 015
Revises: 014
Create Date: 2026-05-18 12:00:00.000000

Migration 014 added 'nessus' (lowercase) to the scantype enum, but
the initial-schema (001) created the enum with UPPERCASE values
('FULL', 'SYSCOLLECTOR', 'MANUAL') and SQLAlchemy's SQLEnum binding
serializes enum members by NAME (also uppercase). Inserts therefore
hit:

    invalid input value for enum scantype: "NESSUS"

This migration adds the missing 'NESSUS' value. The lowercase
'nessus' from 014 stays — Postgres has no clean DROP VALUE for
enums, but the dead value is harmless (nothing writes it).

Idempotent via ADD VALUE IF NOT EXISTS.
"""
from alembic import op


revision = '015'
down_revision = '014'
branch_labels = None
depends_on = None


def upgrade() -> None:
    op.execute("ALTER TYPE scantype ADD VALUE IF NOT EXISTS 'NESSUS'")


def downgrade() -> None:
    # No-op: Postgres cannot drop enum values without recreating the type.
    pass
