-- ABS-64255 / ABS-64945
--- CONTRACTCOMPONENTMISC ---
ALTER TABLE CONTRACTCOMPONENTMISC ADD (AUTOSOILPERCENTAGE NUMBER DEFAULT 0.0 NOT NULL
					CONSTRAINT AUTOSOILPERCENTAGE_VALID1_1 CHECK (AUTOSOILPERCENTAGE BETWEEN 0.0 AND 100.0));

COMMENT ON COLUMN CONTRACTCOMPONENTMISC.AUTOSOILPERCENTAGE IS 'Used as a default for ContractProduct and also compliancy for customers';

--- CONTRACTPRODUCTORDERDELIVERY ---
ALTER TABLE CONTRACTPRODUCTORDERDELIVERY ADD (AUTOSOILPERCENTAGE NUMBER DEFAULT 0.0 NOT NULL
						CONSTRAINT AUTOSOILPERCENTAGE_VALID1_2 CHECK (AUTOSOILPERCENTAGE BETWEEN 0.0 AND 100.0));

--- CUSTOMER ---
ALTER TABLE CUSTOMER ADD (AUTOSOILPERCENTAGE NUMBER DEFAULT 0.0 NOT NULL
			CONSTRAINT AUTOSOILPERCENTAGE_VALID1_3 CHECK (AUTOSOILPERCENTAGE BETWEEN 0.0 AND 100.0));

COMMENT ON COLUMN CUSTOMER.AUTOSOILPERCENTAGE IS 'Used as the default for PLPC';

--- PRODUCTLISTPERCUSTOMER ---
ALTER TABLE PRODUCTLISTPERCUSTOMER ADD CONSTRAINT AUTOSOILPERCENTAGE_VALID1_4 CHECK (AUTOSOILPERCENTAGE BETWEEN 0.0 AND 100.0);

--- CONTRACTATTRIBUTE ---
INSERT INTO CONTRACTATTRIBUTE
  (CONTRACTATTRIBUTE_ID, GROUPNUMBER, SEQUENCENUMBER, FACTORYNAME, INTERNALNAME, SYSTEMUSER_ID, TIMESTAMP, NOVALUERULE)
VALUES
  (176, 2, 16, 'AutoSoilPercentage', 'ccAutoSoilPercentage', GETMINSYSTEMUSER(), sysdate, 0);
COMMIT;

INSERT INTO CONTRACTATTRIBUTE
  (CONTRACTATTRIBUTE_ID, GROUPNUMBER, SEQUENCENUMBER, FACTORYNAME, INTERNALNAME, SYSTEMUSER_ID, TIMESTAMP, NOVALUERULE)
VALUES
  (177, 12, 14, 'PLPCAutoSoilPercentage', 'PLPCAutoSoilPercentage', GETMINSYSTEMUSER(), sysdate, 0);
COMMIT;
