-- ABS-61887

ALTER TRIGGER CUSTOMER_CHECK_CONTRACT_USAGE DISABLE;
ALTER TRIGGER AFTER_UPDATE_CUSTOMER DISABLE;

UPDATE CUSTOMER C
SET C.TIMESTAMP = SYSDATE, C.PAYMENTMETHOD = 1
WHERE NVL(C.PAYMENTTYPE, 0) = 0
AND C.PAYMENTMETHOD <> 1;
COMMIT;

UPDATE CUSTOMER C
 SET C.TIMESTAMP = SYSDATE, C.PAYMENTMETHOD = 2
 WHERE NVL(C.PAYMENTTYPE, 0) > 0
 AND C.PAYMENTMETHOD <> 2;
 COMMIT;
 
 ALTER TRIGGER CUSTOMER_CHECK_CONTRACT_USAGE ENABLE;
ALTER TRIGGER AFTER_UPDATE_CUSTOMER ENABLE;

 ALTER TABLE CUSTOMER
 ADD CONSTRAINT CHK_CUSTOMER_PAYMENTTYPE
 CHECK (( NVL(PAYMENTTYPE,0)=0 AND PAYMENTMETHOD=1) OR PAYMENTMETHOD=2);