-- 
-- Licensed to the Apache Software Foundation (ASF) under one
-- or more contributor license agreements.  See the NOTICE file
-- distributed with this work for additional information
-- regarding copyright ownership.  The ASF licenses this file
-- to you under the Apache License, Version 2.0 (the
-- "License"); you may not use this file except in compliance
-- with the License.  You may obtain a copy of the License at
--   
--     http://www.apache.org/licenses/LICENSE-2.0
--   
-- Unless required by applicable law or agreed to in writing, software
-- distributed under the License is distributed on an "AS IS" BASIS,
-- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-- See the License for the specific language governing permissions and
-- limitations under the License.
-- 

ALTER TABLE WF_JOBS ADD PARENT_ID VARCHAR2(255);
ALTER TABLE WF_ACTIONS MODIFY EXECUTION_PATH VARCHAR2(1024);
ALTER TABLE COORD_JOBS ADD PENDING NUMBER DEFAULT 0;
ALTER TABLE COORD_JOBS ADD MAT_THROTTLING NUMBER DEFAULT 12;
ALTER TABLE COORD_JOBS ADD DONE_MATERIALIZATION NUMBER DEFAULT 0;
ALTER TABLE COORD_JOBS ADD APP_NAMESPACE VARCHAR2(255) DEFAULT 'uri:oozie:coordinator:0.1';
ALTER TABLE COORD_ACTIONS ADD PENDING NUMBER DEFAULT 0;

# please replace "OOZIEDB" to your schema name

CREATE TABLE "OOZIEDB"."BUNDLE_JOBS" 
 ("ID" VARCHAR2(255) NOT NULL ENABLE, 
"APP_NAME" VARCHAR2(255), 
"APP_PATH" VARCHAR2(255), 
"CONF" CLOB, 
"EXTERNAL_ID" VARCHAR2(255), 
"GROUP_NAME" VARCHAR2(255), 
"TIME_OUT" NUMBER, 
"USER_NAME" VARCHAR2(255), 
"BEAN_TYPE" VARCHAR2(31), 
"AUTH_TOKEN" CLOB, 
"CREATED_TIME" TIMESTAMP (6), 
"END_TIME" TIMESTAMP (6), 
"JOB_XML" CLOB, 
"KICKOFF_TIME" TIMESTAMP (6), 
"LAST_MODIFIED_TIME" TIMESTAMP (6), 
"ORIG_JOB_XML" CLOB, 
"PAUSE_TIME" TIMESTAMP (6), 
"PENDING" NUMBER, 
"START_TIME" TIMESTAMP (6), 
"STATUS" VARCHAR2(255), 
"SUSPENDED_TIME" TIMESTAMP (6), 
"TIME_UNIT" VARCHAR2(255), 
 PRIMARY KEY ("ID")
USING INDEX PCTFREE 10 INITRANS 2 MAXTRANS 255 COMPUTE STATISTICS 
STORAGE(INITIAL 65536 NEXT 1048576 MINEXTENTS 1 MAXEXTENTS 2147483645
PCTINCREASE 0 FREELISTS 1 FREELIST GROUPS 1 BUFFER_POOL DEFAULT FLASH_CACHE DEFAULT CELL_FLASH_CACHE DEFAULT)
TABLESPACE "OOZIEDB" ENABLE
 ) SEGMENT CREATION IMMEDIATE 
PCTFREE 10 PCTUSED 40 INITRANS 1 MAXTRANS 255 NOCOMPRESS LOGGING
STORAGE(INITIAL 65536 NEXT 1048576 MINEXTENTS 1 MAXEXTENTS 2147483645
PCTINCREASE 0 FREELISTS 1 FREELIST GROUPS 1 BUFFER_POOL DEFAULT FLASH_CACHE DEFAULT CELL_FLASH_CACHE DEFAULT)
TABLESPACE "OOZIEDB" 
 LOB ("CONF") STORE AS BASICFILE (
TABLESPACE "OOZIEDB" ENABLE STORAGE IN ROW CHUNK 8192 RETENTION 
NOCACHE LOGGING 
STORAGE(INITIAL 65536 NEXT 1048576 MINEXTENTS 1 MAXEXTENTS 2147483645
PCTINCREASE 0 FREELISTS 1 FREELIST GROUPS 1 BUFFER_POOL DEFAULT FLASH_CACHE DEFAULT CELL_FLASH_CACHE DEFAULT)) 
 LOB ("AUTH_TOKEN") STORE AS BASICFILE (
TABLESPACE "OOZIEDB" ENABLE STORAGE IN ROW CHUNK 8192 RETENTION 
NOCACHE LOGGING 
STORAGE(INITIAL 65536 NEXT 1048576 MINEXTENTS 1 MAXEXTENTS 2147483645
PCTINCREASE 0 FREELISTS 1 FREELIST GROUPS 1 BUFFER_POOL DEFAULT FLASH_CACHE DEFAULT CELL_FLASH_CACHE DEFAULT)) 
 LOB ("JOB_XML") STORE AS BASICFILE (
TABLESPACE "OOZIEDB" ENABLE STORAGE IN ROW CHUNK 8192 RETENTION 
NOCACHE LOGGING 
STORAGE(INITIAL 65536 NEXT 1048576 MINEXTENTS 1 MAXEXTENTS 2147483645
PCTINCREASE 0 FREELISTS 1 FREELIST GROUPS 1 BUFFER_POOL DEFAULT FLASH_CACHE DEFAULT CELL_FLASH_CACHE DEFAULT)) 
 LOB ("ORIG_JOB_XML") STORE AS BASICFILE (
TABLESPACE "OOZIEDB" ENABLE STORAGE IN ROW CHUNK 8192 RETENTION 
NOCACHE LOGGING 
STORAGE(INITIAL 65536 NEXT 1048576 MINEXTENTS 1 MAXEXTENTS 2147483645
PCTINCREASE 0 FREELISTS 1 FREELIST GROUPS 1 BUFFER_POOL DEFAULT FLASH_CACHE DEFAULT CELL_FLASH_CACHE DEFAULT));


CREATE TABLE "OOZIEDB"."BUNDLE_ACTIONS" 
 ("BUNDLE_ACTION_ID" VARCHAR2(255) NOT NULL ENABLE, 
"BUNDLE_ID" VARCHAR2(255), 
"COORD_ID" VARCHAR2(255), 
"COORD_NAME" VARCHAR2(255), 
"CRITICAL" NUMBER, 
"LAST_MODIFIED_TIME" TIMESTAMP (6), 
"PENDING" NUMBER, 
"STATUS" VARCHAR2(255), 
"BEAN_TYPE" VARCHAR2(31), 
 PRIMARY KEY ("BUNDLE_ACTION_ID")
USING INDEX PCTFREE 10 INITRANS 2 MAXTRANS 255 COMPUTE STATISTICS 
STORAGE(INITIAL 65536 NEXT 1048576 MINEXTENTS 1 MAXEXTENTS 2147483645
PCTINCREASE 0 FREELISTS 1 FREELIST GROUPS 1 BUFFER_POOL DEFAULT FLASH_CACHE DEFAULT CELL_FLASH_CACHE DEFAULT)
TABLESPACE "OOZIEDB" ENABLE
 ) SEGMENT CREATION IMMEDIATE 
PCTFREE 10 PCTUSED 40 INITRANS 1 MAXTRANS 255 NOCOMPRESS LOGGING
STORAGE(INITIAL 65536 NEXT 1048576 MINEXTENTS 1 MAXEXTENTS 2147483645
PCTINCREASE 0 FREELISTS 1 FREELIST GROUPS 1 BUFFER_POOL DEFAULT FLASH_CACHE DEFAULT CELL_FLASH_CACHE DEFAULT)
TABLESPACE "OOZIEDB";

