--UPDATE FROM 8.9.0.1 TO 8.9.0.2


DROP TABLE VERSION_8_9_0_1;



/*  VERSION_8_9_0_2  */
CREATE TABLE VERSION_8_9_0_2 (
	 DUMMY	NUMBER	    NULL
)
;

INSERT INTO ZFST (ZFST_ID, ZFST_LONGDESC, ZFST_WRPT_ID, ZFST_DEFAULT, ZFST_DISPLORDER, ZFST_INACTIVE, ZFST_ZINN_ID, ZFST_PURPOSE, ZFST_NDC) VALUES (SEQ_ZFST.NEXTVAL,'Paid Out',(SELECT WUSS_VALUE FROM WUSS WHERE WUSS_XCMS_ID=0 AND WUSS_NAME='paidoutreceipt'),0,(SELECT MAX(ZFST_DISPLORDER)+1 FROM ZFST),0,NULL,0,0); 

ALTER TABLE ZPOS ADD ZPOS_WPCA_ID NUMBER(30);

ALTER TABLE WMAI ADD WMAI_ERROR VARCHAR2(2000);

COMMENT ON COLUMN WMAI.WMAI_ERROR IS 'Error while sending';

ALTER TABLE YBLH ADD YBLH_ADDTOMEALPLAN NUMBER(1) DEFAULT 1 NOT NULL;

ALTER TABLE YCEV ADD YCEV_LOCATIONID NUMBER(30);

ALTER TABLE YCEV ADD YCEV_LOCATIONTYPE NUMBER(1); 

ALTER TABLE YCEV ADD YCEV_TICKET_ZDCO_ID NUMBER(30);

ALTER TABLE YCEV ADD YCEV_DEFAULT_TICKETPRICE NUMBER(30, 4);

ALTER TABLE YCEV ADD YCEV_MAX_WEB_SELL NUMBER(5);

ALTER TABLE YCEV ADD YCEV_EST_ATTENDANCE NUMBER(5);

ALTER TABLE YCET ADD YCET_TICKET_ZDCO_ID NUMBER(30);

ALTER TABLE YCET ADD YCET_ADDATTENDEES NUMBER(1);

ALTER TABLE YCEP ADD YCEP_NOOFADULTS NUMBER(2);

COMMENT ON COLUMN YCEV.YCEV_LOCATIONID IS 'linked location ID ';

COMMENT ON COLUMN YCEV.YCEV_LOCATIONTYPE IS 'Location type 1. Public place(ypub) 2. Restaurant(RRST), 3.Function space(ysfc) ';

COMMENT ON COLUMN YCEV.YCEV_TICKET_ZDCO_ID IS 'Department code for Ticket Revenue';

COMMENT ON COLUMN YCEV.YCEV_DEFAULT_TICKETPRICE IS 'Default Ticket Price';

COMMENT ON COLUMN YCEV.YCEV_MAX_WEB_SELL IS 'Maximum number of tickes can be sold through web';

COMMENT ON COLUMN YCEV.YCEV_EST_ATTENDANCE IS 'Projeced number of attendees';

COMMENT ON COLUMN YCET.YCET_TICKET_ZDCO_ID IS 'Default Department code for Ticket Revenue';

COMMENT ON COLUMN YCET.YCET_ADDATTENDEES IS 'Allow to add Attendees List' ;

COMMENT ON COLUMN YCEP.YCEP_NOOFADULTS IS 'Number of Adults';

DELETE FROM WUSS WHERE WUSS_NAME='BlocksInMealplanForecast';

INSERT INTO WUSS (WUSS_ID,WUSS_XCMS_ID,WUSS_NAME,WUSS_VALUE) VALUES (SEQ_WUSS.NEXTVAL,0,'BlocksInMealplanForecast','1');

UPDATE YBLH SET YBLH_ADDTOMEALPLAN=1;

UPDATE YCEP SET YCEP_NOOFADULTS = 1 WHERE NVL(YCEP_NOOFADULTS,0) = 0;

UPDATE YCET SET YCET_ADDATTENDEES = 1 WHERE YCET_ID IN (SELECT YCET_ID FROM YCET, YCEP, YCEV WHERE YCEP_YCEV_ID = YCEV_ID AND YCEV_YCET_ID = YCET_ID);

ALTER TABLE QNRF ADD QNRF_YBOM_ID NUMBER(30);

COMMENT ON COLUMN QNRF.QNRF_YBOM_ID IS 'Link to booking id';

CREATE TABLE WSKL (
 WSKL_ID NUMBER(30) NOT NULL
,WSKL_XCMS_ID NUMBER(30) NOT NULL
,WSKL_WATY_ID NUMBER(30) NOT NULL
,WSKL_DISPLORDER NUMBER(4)
,CONSTRAINT WSKL_PK PRIMARY KEY (WSKL_ID) USING INDEX TABLESPACE V8INDEX) TABLESPACE V8CONF;

COMMENT ON TABLE WSKL IS 'Maintenance tasks, skills';

CREATE SEQUENCE SEQ_WSKL INCREMENT BY 1 START WITH 1000 NOMAXVALUE NOCYCLE NOCACHE NOORDER;

INSERT INTO WSKL ( WSKL_ID, WSKL_XCMS_ID, WSKL_WATY_ID, WSKL_DISPLORDER) (SELECT  SEQ_WSKL.NEXTVAL, WATY_XCED_ID, WATY_ID , 1 FROM WATY WHERE WATY_XCED_ID IS NOT NULL);

ALTER TABLE WATY  ADD WATY_PRIORITY NUMBER(1) ;

UPDATE WATY SET WATY_PRIORITY = 0 WHERE WATY_PRIORITY IS NULL;
  
COMMENT ON COLUMN WATY.WATY_PRIORITY IS ' 0 = Normal | 1 = low | 2 = High';

CREATE TABLE WMSL (
 WMSL_ID NUMBER(30) NOT NULL
,WMSL_SHORTDESC VARCHAR2(3) NOT NULL
,WMSL_LONGDESC VARCHAR2(30) NOT NULL
,WMSL_DISPLORDER NUMBER(3,0) NOT NULL
,WMSL_WEBENABLED NUMBER (1) NOT NULL
,WMSL_INACTIVE NUMBER(1) NOT NULL
,CONSTRAINT WMSL_PK PRIMARY KEY (WMSL_ID) USING INDEX TABLESPACE V8INDEX) TABLESPACE V8CONF;

COMMENT ON TABLE WMSL IS 'Maintenance status level';

CREATE SEQUENCE SEQ_WMSL INCREMENT BY 1 START WITH 1000 NOMAXVALUE NOCYCLE NOCACHE NOORDER;

ALTER TABLE WACT ADD WACT_WMSL_ID NUMBER(30);

COMMENT ON COLUMN WACT.WACT_WMSL_ID IS 'Referenced Activity Status Level Id';

UPDATE WUSS SET WUSS_NAME = 'Maintenance Resolved' WHERE WUSS_NAME = 'Resolved' AND WUSS_XCMS_ID = 0; 

UPDATE WUSS SET WUSS_NAME = 'Maintenance Unresolved' WHERE WUSS_NAME = 'Unresolved' AND WUSS_XCMS_ID = 0; 

UPDATE WUSS SET WUSS_NAME = 'Cancel Table Reservation' WHERE WUSS_NAME = 'Cancel' AND WUSS_XCMS_ID = 0 ;

UPDATE WUSS SET WUSS_NAME = 'Reinstate Table Reservation' WHERE WUSS_NAME = 'Reinstate' AND WUSS_XCMS_ID = 0;

UPDATE WUSS SET WUSS_NAME = 'Redeem Voucher' WHERE WUSS_NAME = 'Redeem' AND WUSS_XCMS_ID = 0;

ALTER TABLE WACT  ADD WACT_ESTIMATED_DURATION_MIN NUMBER(12) ;

COMMENT ON COLUMN WACT.WACT_ESTIMATED_DURATION_MIN IS 'estimated time that it takes in minutes';

ALTER TABLE WACT  ADD WACT_ACTUAL_DURATION_MIN NUMBER(12) ;

COMMENT ON COLUMN WACT.WACT_ACTUAL_DURATION_MIN IS 'actual time it took in minutes';

ALTER TABLE WATY  ADD WATY_ASKDURATION NUMBER(1) ;

COMMENT ON COLUMN WATY.WATY_ASKDURATION IS 'Flag for Ask Duration on maintenance completion';

ALTER TABLE WMSL ADD WMSL_FORRESOLVE NUMBER(1) ;

COMMENT ON COLUMN WMSL.WMSL_FORRESOLVE IS 'Flag for maintenance Resolution status';

ALTER TABLE WATY  ADD WATY_DURATION_MIN NUMBER(8) ;

COMMENT ON COLUMN WATY.WATY_DURATION_MIN IS 'required time to complete task';

ALTER TABLE COUP MODIFY COUP_DESCRIPTION VARCHAR2(4000);

ALTER TABLE CART MODIFY CART_COUPONDESCR VARCHAR2(4000);

COMMENT ON COLUMN MCNV.MCNV_TYPE IS 'RC= rate code, RT= room type, MC= market code, SC= source code, CH= channel, GT= guarantee type, PM= payment method, CC= credit card, CO= country, ST= state, CU= currency, LA= language, BC= block code, SP= specials, FE= features, CR= cancellation reason, DO= document type, CT= card type, AT= address type, CM= communication type, SA= Salutation codes, PA= Packages, II= Inventory Items, AL= Airlines, PT= Pickup types, RA= rate category, used for OXI rate code request, CA= child age category, VC= VIP code, DC= Department code, used for OXI rate code request, WL= Waitlist reason, NA= nationality, BI= Billing Instructions  -> this is not yet an conversion type, NT= Note Types, BS= Block Status, CD= Commission Code, TR= Traces, X0= user defined type, X1= user defined type, X2= user defined type, X3= user defined type, X4= user defined type, X5= user defined type, X6= user defined type, X7= user defined type, X8= user defined type, X9= user defined type ';
