fix(km): add phase25 knowledge enum labels
Some checks failed
CD Pipeline / tests (push) Successful in 2m14s
Code Review / ai-code-review (push) Successful in 26s
run-migration / migrate (push) Failing after 24s
CD Pipeline / build-and-deploy (push) Has been cancelled
CD Pipeline / post-deploy-checks (push) Has been cancelled

This commit is contained in:
Your Name
2026-05-01 11:03:03 +08:00
parent ce4cf4c94b
commit 3a6acae408
3 changed files with 8 additions and 1 deletions

View File

@@ -0,0 +1,6 @@
-- 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.
ALTER TYPE entrytype ADD VALUE IF NOT EXISTS 'AUTO_RUNBOOK';
ALTER TYPE entrytype ADD VALUE IF NOT EXISTS 'ANTI_PATTERN';

View File

@@ -26,7 +26,7 @@ DO $$ BEGIN
CREATE TYPE entrystatus AS ENUM ('DRAFT','REVIEW','APPROVED','ARCHIVED','published');
END IF;
IF NOT EXISTS (SELECT 1 FROM pg_type WHERE typname = 'entrytype') THEN
CREATE TYPE entrytype AS ENUM ('INCIDENT_CASE','RUNBOOK','BEST_PRACTICE','POSTMORTEM','auto_runbook','anti_pattern');
CREATE TYPE entrytype AS ENUM ('INCIDENT_CASE','RUNBOOK','BEST_PRACTICE','POSTMORTEM','auto_runbook','anti_pattern','AUTO_RUNBOOK','ANTI_PATTERN');
END IF;
END $$;