-- t-paliad-131 Phase A3: condition_flag text → text[]. -- -- The current scalar column supports "rule renders only if ONE flag is -- set". The Phase B1 UPC counterclaim cross-flows need conditional rules -- that depend on TWO flags simultaneously (e.g. UPC_INF Application to -- amend requires both `with_ccr` AND `with_amend`; UPC_REV chains require -- with_amend AND/OR with_cci as independent gates). -- -- New semantic: rule renders iff condition_flag is NULL/empty OR every -- element of condition_flag is present in the caller's flag set. -- Single-element arrays preserve the old behaviour exactly — the existing -- two `with_ccr` rules on UPC_INF migrate cleanly via ARRAY['with_ccr']. -- -- The matching code change in internal/services/fristenrechner.go ships -- in the same PR; both must land together. ALTER TABLE paliad.deadline_rules ALTER COLUMN condition_flag TYPE text[] USING (CASE WHEN condition_flag IS NULL THEN NULL ELSE ARRAY[condition_flag] END); COMMENT ON COLUMN paliad.deadline_rules.condition_flag IS 'Flag-conditioned rule. Array of flag codes; rule renders iff every ' 'element is present in CalcOptions.Flags. NULL/empty = unconditional. ' 'When set + all flags satisfied AND alt_duration_value is non-NULL, ' 'the calculator swaps to alt_duration_value/alt_duration_unit/' 'alt_rule_code (existing semantic preserved). When set + flags not ' 'satisfied, the rule is suppressed entirely (new semantic for Phase ' 'B1 cross-flow rules that should not appear without their flag).';