-- ABS-74110/ ABS-82229

-- drop unnecessary tables --
DROP TABLE CGPBATCHCONTENTS;
DROP TABLE CGPSORTBOXUNIQUEITEM;
DROP TABLE CGPSORTBOX;
DROP TABLE CGPBATCH;
DROP TABLE PLANTINTERFACESETTINGS;

-- PACKINGNOTE table --
ALTER TABLE PACKINGNOTE SET UNUSED COLUMN STORE;
ALTER TABLE PACKINGNOTE SET UNUSED COLUMN CGPWORKSTATION_ID;
  
-- WORKSTATION table -- 
ALTER TABLE WORKSTATION DROP COLUMN CGPTABLENUMBER;
ALTER TABLE WORKSTATION DROP COLUMN CGPDISTRICT_ID;
ALTER TABLE WORKSTATION DROP COLUMN CGPHICARE;
ALTER TABLE WORKSTATION DROP COLUMN CGPBOXVOLUME;
ALTER TABLE WORKSTATION DROP COLUMN CGPHICARENROFBOXES;
ALTER TABLE WORKSTATION DROP COLUMN CGPWEIGHTLEVELMIN;
ALTER TABLE WORKSTATION DROP COLUMN CGPWEIGHTLEVELMAX;
ALTER TABLE WORKSTATION DROP COLUMN CGPSOILRECEIVING;
ALTER TABLE WORKSTATION DROP COLUMN CGPCLEANSORTSCANDLG;
ALTER TABLE WORKSTATION DROP COLUMN CGPROUTECOLLECTION;
ALTER TABLE WORKSTATION DROP COLUMN CGPSEALSCANDLG;
ALTER TABLE WORKSTATION DROP COLUMN CGPSEALOUTSCANDLG;

-- ROUTECONTROL table -- 
ALTER TABLE ROUTECONTROL DROP COLUMN COLLECTWORKSTATION_ID;

-- SYSTEMSETTING table --
DELETE FROM SYSTEMSETTING SS
WHERE SS.NAME IN ('CGPWEIGHTLEVELMAX', 'CGPWEIGHTLEVELMIN', 'CGPHICAREWEIGHTLEVELMAX', 'CGPHICAREWEIGHTLEVELMIN');
COMMIT;