I've got the following error:

    ERROR: check constraint "cc_at_least_one_mapping_needed" is violated by some row

**Query:**

    ALTER TABLE integrations.accounts
    DROP COLUMN IF EXISTS myob_settings,
    ADD COLUMN myob_settings JSON;
        
    ALTER TABLE integrations.accounts DROP CONSTRAINT IF EXISTS cc_at_least_one_setting_needed,
        ADD CONSTRAINT cc_at_least_one_setting_needed CHECK (("qb_settings" IS NOT NULL) or
                                                              ("xero_settings" IS NOT NULL) or
                                                              ("freshbooks_settings" IS NOT NULL) or
                                                              ("myob_settings" IS NOT NULL) or
                                                              ("ppy_settings" IS NOT NULL));

Select results:

    SELECT * FROM integrations.accounts WHERE qb_settings IS NOT NULL AND xero_settings IS NOT NULL and freshbooks_settings IS NOT NULL AND myob_settings IS NOT NULL AND ppy_settings IS NOT NULL

> It returns 0 rows

------

    SELECT * FROM integrations.accounts WHERE qb_settings IS NULL OR xero_settings IS NULL OR freshbooks_settings IS NULL OR myob_settings IS NULL OR ppy_settings IS NULL;

> RETURN (59 rows):

**UPDATED: (Same query above)**

Is there any way to add the CONSTRAINT for the next rows? not for those which already exists?

1. I can't set a default value
2. Ran the command below (I got 59 rows / **But there are some other tables to do the same process and I get over 3m rows**)

> SELECT * FROM integrations.accounts WHERE qb_settings IS NOT NULL OR  
> xero_settings IS NOT NULL OR...

3. How can I add the Constraint without have a default value?

>     ALTER TABLE integrations.accounts DROP CONSTRAINT IF EXISTS cc_at_least_one_setting_needed,
>     ADD CONSTRAINT cc_at_least_one_setting_needed CHECK ((("qb_settings" IS NOT NULL) :: INTEGER +
>                                                           ("xero_settings" IS NOT NULL) :: INTEGER +
>                                                           ("freshbooks_settings" IS NOT NULL) :: INTEGER +
>                                                           ("myob_settings" IS NOT NULL) :: INTEGER +
>                                                           ("ppy_settings" IS NOT NULL) :: INTEGER) > 0) NOT VALID;

Would that be useful ?