--UPDATE FROM 8.7.1.0 TO 8.7.2.0


DROP TABLE VERSION_8_7_1_0;



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


DROP VIEW V8_IFC_DESTINATION_ID;

DROP VIEW V8_IFC_DEST_ID;

ALTER TABLE ZDC2 ADD ZDC2_IFC_VALUE VARCHAR2(30);

CREATE TABLE YALG (
    YALG_ID NUMBER(30) NOT NULL,
    YALG_NAME VARCHAR2(30) NOT NULL,
    CONSTRAINT YALG_PK PRIMARY KEY (YALG_ID) USING INDEX TABLESPACE V8INDEX) TABLESPACE V8CONF;

COMMENT ON TABLE YALG IS 'Availability limit group';

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

ALTER TABLE YOVB ADD YOVB_YALG_ID NUMBER(30);

COMMENT ON COLUMN YOVB.YOVB_TYPE IS '1 = House Overbooking 	2 = Room Type Overbooking 	3 = channel leave empty  4 = channel house leave empty 	5 = channel percentage leave empty 6=channel percentage house leave empty';

ALTER TABLE YGRP ADD YGRP_NOJETWEBGROUP NUMBER (1);

ALTER TABLE MMOD ADD (MMOD_YALG_ID NUMBER(30,0) NULL);

ALTER TABLE MMOD ADD (MMOD_YRCH_ID NUMBER(30,0) NULL);

COMMENT ON COLUMN MMOD.MMOD_YALG_ID IS 'Availability Limit Group Id';

COMMENT ON COLUMN MMOD.MMOD_YRCH_ID IS 'Rate Code id for Expedia';

ALTER TABLE XPDC ADD XPDC_GLOBALID NUMBER(30);

CREATE UNIQUE INDEX XPDC_GLOBALID ON XPDC (XPDC_GLOBALID) TABLESPACE V8INDEX;

ALTER TABLE WANT ADD WANT_NOTES_CLOB CLOB;

COMMENT ON COLUMN WANT.WANT_NOTES_CLOB IS 'CLOB type notes field for locator in order to be able to use it in subselects';

CREATE TABLE YRDT 
(
  YRDT_ID NUMBER(30),
  YRDT_SHORTDESC VARCHAR2(3),
  YRDT_LONGDESC VARCHAR2(60),
  YRDT_DISPLORDER NUMBER(3),
  YRDT_INACTIVE NUMBER(1),
  YRDT_WCOL_ID NUMBER(30),
  CONSTRAINT YRDT_PK PRIMARY KEY (YRDT_ID) USING INDEX TABLESPACE V8INDEX) TABLESPACE V8CONF;
 
CREATE SEQUENCE SEQ_YRDT INCREMENT BY 1 START WITH 1000 NOMAXVALUE NOCYCLE NOCACHE NOORDER;

COMMENT ON TABLE YRDT IS 'RATES DAY TYPE TABLE';

CREATE TABLE YRDD 
(
  YRDD_ID NUMBER(30),
  YRDD_YRDT_ID NUMBER(30),
  YRDD_YCAT_ID NUMBER(30),
  YRDD_VALUE NUMBER(10,4),
  CONSTRAINT YRDD_PK PRIMARY KEY (YRDD_ID) USING INDEX TABLESPACE V8INDEX) TABLESPACE V8CONF;
 
CREATE SEQUENCE SEQ_YRDD INCREMENT BY 1 START WITH 1000 NOMAXVALUE NOCYCLE NOCACHE NOORDER;

COMMENT ON TABLE YRDD IS 'RATES DAY TYPE PER ROOMTYPE ADULT VALUES TABLE';

CREATE INDEX YRDD_YRDT_ID ON YRDD(YRDD_YRDT_ID) TABLESPACE V8INDEX;

CREATE INDEX YRDD_YCAT_ID ON YRDD(YRDD_YCAT_ID) TABLESPACE V8INDEX;

CREATE TABLE YRDX 
(
  YRDX_ID NUMBER(30),
  YRDX_YRDD_ID NUMBER(30),
  YRDX_XCAC_ID NUMBER(30),
  YRDX_VALUE NUMBER(10,4),
  CONSTRAINT YRDX_PK PRIMARY KEY (YRDX_ID) USING INDEX TABLESPACE V8INDEX) TABLESPACE V8CONF;
 
CREATE SEQUENCE SEQ_YRDX INCREMENT BY 1 START WITH 1000 NOMAXVALUE NOCYCLE NOCACHE NOORDER;

COMMENT ON TABLE YRDX IS 'RATES DAY TYPE PER ROOMTYPE CHILD VALUES TABLE';

CREATE INDEX YRDX_YRDD_ID ON YRDX(YRDX_YRDD_ID) TABLESPACE V8INDEX;

CREATE INDEX YRDX_XCAC_ID ON YRDX(YRDX_XCAC_ID) TABLESPACE V8INDEX;

CREATE TABLE YRDC 
(
  YRDC_ID NUMBER(30),
  YRDC_YRDT_ID NUMBER(30),
  YRDC_DATE DATE,
  CONSTRAINT YRDC_PK PRIMARY KEY (YRDC_ID) USING INDEX TABLESPACE V8INDEX) TABLESPACE V8CONF;
 
CREATE SEQUENCE SEQ_YRDC INCREMENT BY 1 START WITH 1000 NOMAXVALUE NOCYCLE NOCACHE NOORDER;

COMMENT ON TABLE YRDC IS 'DAY TYPE CALENDAR';

CREATE INDEX YRDC_YRDT_ID ON YRDC(YRDC_YRDT_ID) TABLESPACE V8INDEX;

CREATE INDEX YRDC_DATE ON YRDC(YRDC_DATE) TABLESPACE V8INDEX;

ALTER TABLE YRCH ADD YRCH_DAYTYPE NUMBER (1);

COMMENT ON COLUMN YRCH.YRCH_DAYTYPE IS 'Include /exclude of day type calculation with this rate code';


CREATE TABLE YRDS 
(
  YRDS_ID NUMBER(30),
  YRDS_SHORTDESC VARCHAR2(3),
  YRDS_LONGDESC VARCHAR2(60),
  YRDS_DISPLORDER NUMBER(3),
  YRDS_INACTIVE NUMBER(1),
  CONSTRAINT YRDS_PK PRIMARY KEY (YRDS_ID) USING INDEX TABLESPACE V8INDEX) TABLESPACE V8CONF;
 
CREATE SEQUENCE SEQ_YRDS INCREMENT BY 1 START WITH 1000 NOMAXVALUE NOCYCLE NOCACHE NOORDER;

COMMENT ON TABLE YRDS IS 'DAY TYPE SCHEMA';

ALTER TABLE YRCH ADD YRCH_YRDS_ID NUMBER(30);

CREATE INDEX YRCH_YRDS_ID ON YRCH(YRCH_YRDS_ID) TABLESPACE V8INDEX;

COMMENT ON COLUMN YRCH.YRCH_YRDS_ID IS 'Day Types Schema Link';

ALTER TABLE YRDD ADD YRDD_YRDS_ID NUMBER (30);

CREATE INDEX YRDD_YRDS_ID ON YRDD(YRDD_YRDS_ID) TABLESPACE V8INDEX;

ALTER TABLE YRCH ADD YRCH_COMM_PERC NUMBER (10,4);

COMMENT ON COLUMN YRCH.YRCH_COMM_PERC IS 'Commission percentage field to have Conmpatibility with Myfidelio.net';

ALTER TABLE YFRE ADD YFRE_CRSRESNR VARCHAR(30);

ALTER TABLE YFRE ADD YFRE_CRSSYSTEM VARCHAR(30);  

CREATE INDEX XJLG_regcard ON XJLG(XJLG_REGCARD) TABLESPACE v8index;
 
ALTER TABLE XJLG ADD XJLG_MESSAGETYPE NUMBER(1);
 
COMMENT ON COLUMN XJLG.XJLG_MESSAGETYPE IS '1 = arrival 2 = departure';

ALTER TABLE ZITF ADD ZITF_ZITI_ID NUMBER(30);

CREATE TABLE YDRC 
(
  YDRC_ID NUMBER(30),
  YDRC_WLAN_ID NUMBER(30),
  YDRC_YRMS_ID NUMBER(30),
  YDRC_YCAT_ID NUMBER(30),
  YDRC_DESC VARCHAR2(2000),
  CONSTRAINT YDRC_PK PRIMARY KEY (YDRC_ID) USING INDEX TABLESPACE V8INDEX) TABLESPACE V8CONF;
 
CREATE SEQUENCE SEQ_YDRC INCREMENT BY 1 START WITH 1000 NOMAXVALUE NOCYCLE NOCACHE NOORDER;

COMMENT ON TABLE YDRC IS 'Loooong descriptions for rooms and room types';

ALTER TABLE XCID ADD XCID_COPYADDRESS NUMBER(1);

COMMENT ON COLUMN XCID.XCID_COPYADDRESS IS 'Copy Family Address Info Flag';

ALTER TABLE XCID ADD XCID_COPYCOMM NUMBER(1);

COMMENT ON COLUMN XCID.XCID_COPYCOMM IS 'Copy Family Communication Flag';

ALTER TABLE XCID ADD XCID_COPYFAMILY NUMBER(1);

COMMENT ON COLUMN XCID.XCID_COPYFAMILY IS 'Copy Family Info Flag';

UPDATE XCID SET XCID_COPYFAMILY=1 WHERE XCID_ID IN(SELECT XIIL_FROM_XCMS_ID FROM XIIL);

UPDATE XCID SET XCID_COPYFAMILY=1 WHERE XCID_ID IN(SELECT XIIL_TO_XCMS_ID FROM XIIL);

ALTER TABLE XPAC ADD XPAC_COPYTORESGUEST NUMBER(1);

COMMENT ON COLUMN XPAC.XPAC_COPYTORESGUEST IS 'Copy guest attributes to reservaton guests';

ALTER TABLE PTIK ADD PTIK_SALESDESC VARCHAR2(30);

ALTER TABLE PRIC ADD (PRIC_DAYEXTENDTYPE NUMBER(1));

COMMENT ON COLUMN PRIC.PRIC_DAYEXTENDTYPE IS 'Which price to post when guest stay extends a day: 0 - no post,  1 - check in day''s price, 2 - current day''s price';

UPDATE PRIC SET PRIC_DAYEXTENDTYPE=0 WHERE PRIC_DAYEXTENDTYPE IS NULL;

ALTER TABLE YRDD ADD YRDD_FLAT NUMBER (1);

COMMENT ON COLUMN YRDD.YRDD_FLAT IS 'Flat daytype values';

UPDATE XCID SET XCID_COPYADDRESS=1 WHERE XCID_COPYADDRESS IS NULL;

UPDATE XCID SET XCID_COPYCOMM=1 WHERE XCID_COPYCOMM IS NULL;

CREATE TABLE WMAA (
	WMAA_ID NUMBER(30,0) NOT NULL,
	WMAA_WMAI_ID NUMBER(30,0) NOT NULL,
	WMAA_FILENAME VARCHAR2(128) NOT NULL,
	WMAA_ATTACHMENT_WTXT_ID NUMBER(30,0) NOT NULL,
	CONSTRAINT WMAA_PK PRIMARY KEY (WMAA_ID) USING INDEX TABLESPACE V8INDEX) TABLESPACE V8MAIN ;

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

CREATE INDEX WMAA_WMAI_ID ON WMAA(WMAA_WMAI_ID) TABLESPACE V8INDEX; 

COMMENT ON TABLE WMAA IS 'Email attachments';

COMMENT ON COLUMN WMAA.WMAA_ID IS 'WMAA PK';

COMMENT ON COLUMN WMAA.WMAA_WMAI_ID IS 'Attachment link to the email';

COMMENT ON COLUMN WMAA.WMAA_FILENAME IS 'Attachment file name';

COMMENT ON COLUMN WMAA.WMAA_ATTACHMENT_WTXT_ID IS 'link to the binary storage';

COMMENT ON COLUMN WTXT.WTXT_DOCFORMAT IS ' 0/null - Ms Word Format; 1-Text; 2-Acrobat PDF; 3-HTML; 4-RTF; 5-MHTML; 6-Unknown. Currently used to store any email attachment ';

