-- 057: Add batch processing paths to canonical_processed_chunks
-- New values: structured_batch, llm_reform_batch (used by batch control generation)

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',
                'structured_batch',
                'llm_reform_batch'
            ));
    END IF;
END $$;
