-- ABS-62480/ ABS-64157

ALTER TABLE CONTRACT
  DROP CONSTRAINT CONTRACT_OWNERCUST_VALIDATION;

ALTER TABLE CONTRACT
  ADD CONSTRAINT CONTRACT_OWNERCUST_VALIDATION
  CHECK ((OWNER IS NULL AND CUSTOMER_LINK_ID IS NOT NULL AND MASTERAGREEMENT_ID IS NULL) OR (OWNER IS NOT NULL AND CUSTOMER_LINK_ID IS NULL AND MASTERAGREEMENT_ID IS NULL) OR (OWNER IS NULL AND CUSTOMER_LINK_ID IS NULL AND MASTERAGREEMENT_ID IS NOT NULL) OR (OWNER IS NULL AND CUSTOMER_LINK_ID IS NULL AND MASTERAGREEMENT_ID IS NULL AND CATEGORY = 1));
