-- Migration: Remove the legacy CVR uniqueness rule. -- CVR is company metadata and multiple e-conomic customer records may -- legitimately share the same value. This mirrors migration 1000 and keeps -- this historical migration safe when schema detection selects it again. -- Drop old unique constraint ALTER TABLE customers DROP CONSTRAINT IF EXISTS customers_cvr_number_key; DROP INDEX IF EXISTS customers_cvr_number_unique_idx; CREATE INDEX IF NOT EXISTS idx_customers_cvr ON customers(cvr_number) WHERE cvr_number IS NOT NULL AND cvr_number <> ''; COMMENT ON COLUMN customers.cvr_number IS 'Danish CVR number. Informational/searchable; duplicates are allowed.';