-- Phase 25 Knowledge Auto-Harvesting enum compatibility. -- SQLAlchemy stores Enum names (AUTO_RUNBOOK / ANTI_PATTERN) for EntryType. -- Older production DBs only had lowercase labels from the first migration. -- -- Note: some CI migrator roles do not own enum types. Production was patched -- manually on 2026-05-01; this migration is kept as the durable schema record -- and tolerates insufficient_privilege so the migration workflow can continue. DO $$ BEGIN ALTER TYPE entrytype ADD VALUE IF NOT EXISTS 'AUTO_RUNBOOK'; EXCEPTION WHEN insufficient_privilege THEN RAISE NOTICE 'Skipping entrytype AUTO_RUNBOOK; migrator does not own enum type'; END $$; DO $$ BEGIN ALTER TYPE entrytype ADD VALUE IF NOT EXISTS 'ANTI_PATTERN'; EXCEPTION WHEN insufficient_privilege THEN RAISE NOTICE 'Skipping entrytype ANTI_PATTERN; migrator does not own enum type'; END $$;