-- ABS-36019

------------- PACKINGNOTE -------------
ALTER TABLE PACKINGNOTE DROP COLUMN CLEANROOMBATCH_ID CASCADE CONSTRAINTS;

ALTER TABLE PACKINGNOTE ADD (CLEANROOMBATCH VARCHAR2(1) DEFAULT 'N' NOT NULL CONSTRAINT YN_VALIDATIONFIELD351
                            CHECK (CLEANROOMBATCH IN ('Y', 'N')));
                            
COMMENT ON COLUMN PACKINGNOTE.CLEANROOMBATCH IS 'Y - Packing note is generated from Cleanroom Batch Packing';

------------- CLEANROOMBATCHCUSTOMER -------------
ALTER TABLE CLEANROOMBATCHCUSTOMER ADD (PACKINGNOTE_ID NUMBER NULL);

CREATE INDEX XIF4CLEANROOMBATCHCUSTOMER ON CLEANROOMBATCHCUSTOMER (PACKINGNOTE_ID ASC);

ALTER TABLE CLEANROOMBATCHCUSTOMER
  ADD CONSTRAINT CLEANROOMBATCHCUSTOMER_PN FOREIGN KEY (PACKINGNOTE_ID)
  REFERENCES PACKINGNOTE (PACKINGNOTE_ID) ON DELETE SET NULL;
