-- ABS-20104

------------------  STOCKROOM  ------------
ALTER TABLE STOCKROOM ADD (DETERMINEATP NUMBER DEFAULT 0 NOT NULL CONSTRAINT DETERMINEATP_VALID1_1 CHECK (DETERMINEATP IN (0,1)));

COMMENT ON COLUMN STOCKROOM.DETERMINEATP
  IS 'This attribute indicates whether an ‘Available To Promise’ date may be determined for a work order via a 3d party application. Possible values:
0 = Not enabled
1 = Enabled
Default value 0
The attribute is in fact only relevant when the module DETERMINEATP is in the license';



------------------  NONBUSINESSDAY  ------------
ALTER TABLE NONBUSINESSDAY ADD (STOCKROOM_ID NUMBER NULL);

DROP INDEX XAK1NONBUSINESSDAY;

CREATE UNIQUE INDEX XAK1NONBUSINESSDAY ON NONBUSINESSDAY (NONBUSINESSDAY ASC, CUSTOMER_ID ASC, DEPARTMENT_ID ASC, PLANT_ID ASC, STOCKROOM_ID ASC);

CREATE INDEX XIF47NONBUSINESSDAY ON NONBUSINESSDAY (STOCKROOM_ID ASC);

ALTER TABLE NONBUSINESSDAY
  ADD CONSTRAINT NONBUSINESSDAY_STOCKROOM_ID FOREIGN KEY (STOCKROOM_ID)
  REFERENCES STOCKROOM (STOCKROOM_ID) ON DELETE CASCADE;
  
ALTER TABLE NONBUSINESSDAY
  DROP CONSTRAINT NONBUSINESSDAY_DEPARTMENT_ID;
  
ALTER TABLE NONBUSINESSDAY
  ADD CONSTRAINT NONBUSINESSDAY_DEPARTMENT_ID FOREIGN KEY (DEPARTMENT_ID)
  REFERENCES DEPARTMENT (DEPARTMENT_ID) ON DELETE CASCADE;
  
------------------  WORKORDERLINE  ------------
ALTER TABLE WORKORDERLINE ADD (INTERNALSHIPPINGDATE DATE NULL);

COMMENT ON COLUMN WORKORDERLINE.INTERNALSHIPPINGDATE
  IS 'Will only be used when the module EXTENDEDCUSTOMERSERVICE is active';