MP043WARNINGFree
ban-domain-constraint
What It Detects
Domain constraints validate against ALL rows in ALL columns using that domain.
Why It's Dangerous
Adding or modifying a domain constraint triggers validation against every row in every table that uses the domain type. This can be extremely slow and lock-intensive.
Bad Example
CREATE DOMAIN positive_int AS INTEGER CHECK (VALUE > 0); ALTER DOMAIN positive_int ADD CONSTRAINT min_val CHECK (VALUE >= 1);
Good Example
-- Use column-level CHECK constraints instead ALTER TABLE orders ADD CONSTRAINT chk_qty CHECK (quantity > 0) NOT VALID;
Configuration
Disable this rule:
# .migrationpilotrc.yml rules: MP043: false
Or change its severity:
# .migrationpilotrc.yml
rules:
MP043:
severity: warning