Files
awoooi/apps/api/migrations/phase25_knowledge_enum_names.sql
Your Name 337bcb912e
Some checks failed
CD Pipeline / tests (push) Successful in 1m48s
Code Review / ai-code-review (push) Successful in 27s
run-migration / migrate (push) Successful in 22s
CD Pipeline / build-and-deploy (push) Failing after 31m4s
CD Pipeline / post-deploy-checks (push) Has been skipped
fix(db): tolerate knowledge enum owner mismatch
2026-05-01 11:08:21 +08:00

24 lines
895 B
SQL

-- 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 $$;