Files
breakpilot-compliance/backend-compliance/migrations/048_processing_path_expand.sql
Benjamin Admin 5f8aebf5b1
All checks were successful
CI/CD / go-lint (push) Has been skipped
CI/CD / python-lint (push) Has been skipped
CI/CD / nodejs-lint (push) Has been skipped
CI/CD / test-go-ai-compliance (push) Successful in 32s
CI/CD / test-python-backend-compliance (push) Successful in 33s
CI/CD / test-python-document-crawler (push) Successful in 21s
CI/CD / test-python-dsms-gateway (push) Successful in 17s
CI/CD / validate-canonical-controls (push) Successful in 12s
CI/CD / Deploy (push) Successful in 2s
fix: make migrations 048/049 safe for environments without canonical tables
Migrations 048 and 049 reference canonical_processed_chunks and
canonical_controls tables which may not exist on all environments.
Wrap ALTER TABLE statements in DO blocks that check for table
existence first. This unblocks migrations 050-053 on production.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-14 21:45:00 +01:00

23 lines
872 B
SQL

-- 048: Expand processing_path CHECK constraint for new pipeline paths
-- New values: prefilter_skip, no_control, store_failed, error
-- Safe: only runs if the table exists (may not exist on all environments)
DO $$
BEGIN
IF EXISTS (SELECT 1 FROM information_schema.tables WHERE table_name = 'canonical_processed_chunks') THEN
ALTER TABLE canonical_processed_chunks
DROP CONSTRAINT IF EXISTS canonical_processed_chunks_processing_path_check;
ALTER TABLE canonical_processed_chunks
ADD CONSTRAINT canonical_processed_chunks_processing_path_check
CHECK (processing_path IN (
'structured',
'llm_reform',
'skipped',
'prefilter_skip',
'no_control',
'store_failed',
'error'
));
END IF;
END $$;