tajo-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From jihoon...@apache.org
Subject [6/7] tajo git commit: Merge branch 'master' of https://git-wip-us.apache.org/repos/asf/tajo into index_support
Date Fri, 14 Nov 2014 04:56:05 GMT
Merge branch 'master' of https://git-wip-us.apache.org/repos/asf/tajo into index_support

Conflicts:
	tajo-catalog/tajo-catalog-server/src/main/resources/schemas/derby/indexes.sql


Project: http://git-wip-us.apache.org/repos/asf/tajo/repo
Commit: http://git-wip-us.apache.org/repos/asf/tajo/commit/02b827e2
Tree: http://git-wip-us.apache.org/repos/asf/tajo/tree/02b827e2
Diff: http://git-wip-us.apache.org/repos/asf/tajo/diff/02b827e2

Branch: refs/heads/index_support
Commit: 02b827e2499036374be852c2d98526ae8f0f0d84
Parents: 4a364cf 13af3d3
Author: Jihoon Son <jihoonson@apache.org>
Authored: Fri Nov 14 13:46:08 2014 +0900
Committer: Jihoon Son <jihoonson@apache.org>
Committed: Fri Nov 14 13:46:08 2014 +0900

----------------------------------------------------------------------
 CHANGES                                         |   7 +
 tajo-catalog/tajo-catalog-server/pom.xml        |   6 +
 .../tajo/catalog/store/AbstractDBStore.java     |  96 ++-
 .../apache/tajo/catalog/store/DerbyStore.java   | 330 +--------
 .../apache/tajo/catalog/store/OracleStore.java  | 337 +--------
 .../tajo/catalog/store/PostgreSQLStore.java     | 293 +-------
 .../catalog/store/XMLCatalogSchemaManager.java  | 698 ++++++++++++++++++
 .../tajo/catalog/store/object/BaseSchema.java   |  76 ++
 .../catalog/store/object/DatabaseObject.java    |  80 +++
 .../store/object/DatabaseObjectType.java        |  48 ++
 .../tajo/catalog/store/object/SQLObject.java    |  52 ++
 .../tajo/catalog/store/object/SchemaPatch.java  |  78 +++
 .../tajo/catalog/store/object/StoreObject.java  |  87 +++
 .../resources/schemas/DBMSSchemaDefinition.xsd  | 177 +++++
 .../main/resources/schemas/derby/columns.sql    |   8 -
 .../main/resources/schemas/derby/databases.sql  |   6 -
 .../resources/schemas/derby/databases_idx.sql   |   1 -
 .../src/main/resources/schemas/derby/derby.xml  | 187 +++++
 .../main/resources/schemas/derby/indexes.sql    |  13 -
 .../schemas/derby/partition_methods.sql         |   6 -
 .../main/resources/schemas/derby/partitions.sql |  10 -
 .../src/main/resources/schemas/derby/stats.sql  |   6 -
 .../schemas/derby/table_properties.sql          |   6 -
 .../src/main/resources/schemas/derby/tables.sql |  10 -
 .../resources/schemas/derby/tablespaces.sql     |   7 -
 .../main/resources/schemas/oracle/oracle.xml    | 218 ++++++
 .../resources/schemas/postgresql/indexes.sql    |  14 -
 .../resources/schemas/postgresql/postgresql.xml | 203 ++++++
 .../main/resources/schemas/postgresql/stats.sql |   6 -
 .../store/TestXMLCatalogSchemaManager.java      | 496 +++++++++++++
 .../schemas/derbytest/loadtest/derby.xml        | 191 +++++
 .../derbytest/mergetest/base_version_1.xml      |  35 +
 .../derbytest/mergetest/base_version_2.xml      |  63 ++
 .../schemas/derbytest/querytest/derby.xml       |  78 +++
 .../derbytest/upgradetest/base_version_2.xml    |  57 ++
 tajo-common/pom.xml                             |   4 +
 .../java/org/apache/tajo/datum/DateDatum.java   |  20 +-
 .../org/apache/tajo/datum/TimestampDatum.java   |  11 +-
 .../java/org/apache/tajo/util/NumberUtil.java   | 700 +++++++++++++++++--
 .../org/apache/tajo/util/datetime/TimeMeta.java |  14 +-
 .../org/apache/tajo/datum/TestDateDatum.java    |  17 +-
 .../apache/tajo/datum/TestTimestampDatum.java   |  17 +-
 .../java/org/apache/tajo/storage/RawFile.java   | 184 ++---
 .../tajo/storage/text/DelimitedTextFile.java    |  25 +-
 .../text/TextFieldSerializerDeserializer.java   |  56 +-
 .../org/apache/tajo/storage/TestStorages.java   |  16 +-
 46 files changed, 3800 insertions(+), 1250 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/tajo/blob/02b827e2/tajo-catalog/tajo-catalog-server/src/main/java/org/apache/tajo/catalog/store/AbstractDBStore.java
----------------------------------------------------------------------

http://git-wip-us.apache.org/repos/asf/tajo/blob/02b827e2/tajo-catalog/tajo-catalog-server/src/main/resources/schemas/derby/derby.xml
----------------------------------------------------------------------
diff --cc tajo-catalog/tajo-catalog-server/src/main/resources/schemas/derby/derby.xml
index 0000000,db2473b..b0ba3b9
mode 000000,100644..100644
--- a/tajo-catalog/tajo-catalog-server/src/main/resources/schemas/derby/derby.xml
+++ b/tajo-catalog/tajo-catalog-server/src/main/resources/schemas/derby/derby.xml
@@@ -1,0 -1,186 +1,187 @@@
+ <?xml version="1.0" encoding="UTF-8"?>
+ <!--
+   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.
+   -->
+ <tns:store xmlns:tns="http://tajo.apache.org/catalogstore" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://tajo.apache.org/catalogstore ../DBMSSchemaDefinition.xsd ">
+ 	<tns:base version="2">
+ 		<tns:objects>
+ 			<tns:Object order="0" type="table" name="META">
+ 				<tns:sql><![CDATA[CREATE TABLE META (VERSION INT NOT NULL)]]></tns:sql>
+ 			</tns:Object>
+ 			<tns:Object order="1" type="table" name="TABLESPACES">
+ 				<tns:sql><![CDATA[
+ 				CREATE TABLE TABLESPACES (
+   				SPACE_ID int NOT NULL GENERATED ALWAYS AS IDENTITY (START WITH 1, INCREMENT BY 1),
+   				SPACE_NAME VARCHAR(128) NOT NULL CONSTRAINT SPACE_UNIQUE UNIQUE,
+   				SPACE_HANDLER VARCHAR (1024) DEFAULT 'HDFS',
+   				SPACE_URI VARCHAR (4096) NOT NULL,
+   				CONSTRAINT C_SPACE_PK PRIMARY KEY (SPACE_ID)
+ 				)]]>
+ 				</tns:sql>
+ 			</tns:Object>
+ 			<tns:Object order="2" type="table" name="DATABASES_">
+ 				<tns:sql><![CDATA[
+ 				CREATE TABLE DATABASES_ (
+   				DB_ID int NOT NULL GENERATED ALWAYS AS IDENTITY (START WITH 1, INCREMENT BY 1),
+   				DB_NAME VARCHAR(128) NOT NULL CONSTRAINT DB_NAME_UNIQ UNIQUE,
+   				SPACE_ID INT NOT NULL REFERENCES TABLESPACES (SPACE_ID),
+   				CONSTRAINT DATABASES_PK PRIMARY KEY (DB_ID)
+ 				)]]>
+ 				</tns:sql>
+ 			</tns:Object>
+ 			<tns:Object order="3" type="index" name="IDX_DATABASE_DB_ID" dependsOn="DATABASES_">
+ 				<tns:sql><![CDATA[CREATE UNIQUE INDEX idx_database_db_id on DATABASES_ (DB_ID)]]></tns:sql>
+ 			</tns:Object>
+ 			<tns:Object order="4" type="table" name="TABLES">
+ 				<tns:sql><![CDATA[
+ 				CREATE TABLE TABLES (
+   				TID int NOT NULL GENERATED ALWAYS AS IDENTITY (START WITH 1, INCREMENT BY 1),
+   				DB_ID int NOT NULL REFERENCES DATABASES_ (DB_ID),
+   				TABLE_NAME VARCHAR(128) NOT NULL,
+   				TABLE_TYPE VARCHAR(128) NOT NULL,
+   				PATH VARCHAR(4096),
+   				STORE_TYPE CHAR(16),
+   				CONSTRAINT TABLES_PK PRIMARY KEY (TID),
+   				CONSTRAINT C_TABLE_ID_UNIQ UNIQUE (DB_ID, TABLE_NAME)
+ 				)]]>
+ 				</tns:sql>
+ 			</tns:Object>
+ 			<tns:Object order="5" type="index" name="IDX_TABLES_TID" dependsOn="TABLES">
+ 				<tns:sql><![CDATA[CREATE UNIQUE INDEX idx_tables_tid on TABLES (TID)]]></tns:sql>
+ 			</tns:Object>
+ 			<tns:Object order="6" type="index" name="IDX_TABLES_NAME" dependsOn="TABLES">
+ 				<tns:sql><![CDATA[CREATE UNIQUE INDEX idx_tables_name on TABLES (DB_ID, TABLE_NAME)]]></tns:sql>
+ 			</tns:Object>
+ 			<tns:Object order="7" type="table" name="COLUMNS">
+ 				<tns:sql><![CDATA[
+ 				CREATE TABLE COLUMNS (
+   				TID INT NOT NULL REFERENCES TABLES (TID) ON DELETE CASCADE,
+   				COLUMN_NAME VARCHAR(128) NOT NULL,
+   				ORDINAL_POSITION INTEGER NOT NULL,
+   				DATA_TYPE CHAR(16),
+   				TYPE_LENGTH INTEGER,
+   				CONSTRAINT COLUMNS_PK PRIMARY KEY (TID, COLUMN_NAME)
+ 				)]]>
+ 				</tns:sql>
+ 			</tns:Object>
+ 			<tns:Object order="8" type="index" name="IDX_FK_COLUMNS_TABLE_NAME" dependsOn="COLUMNS">
+ 				<tns:sql><![CDATA[CREATE UNIQUE INDEX idx_fk_columns_table_name on COLUMNS
(TID, COLUMN_NAME)]]></tns:sql>
+ 			</tns:Object>
+ 			<tns:Object order="9" type="table" name="OPTIONS">
+ 				<tns:sql><![CDATA[
+ 				CREATE TABLE OPTIONS (
+   				TID INT NOT NULL REFERENCES TABLES (TID) ON DELETE CASCADE,
+   				KEY_ VARCHAR(255) NOT NULL,
+   				VALUE_ VARCHAR(255) NOT NULL,
+   				CONSTRAINT C_OPTIONS_UNIQUE UNIQUE (TID, KEY_, VALUE_)
+ 				)]]>
+ 				</tns:sql>
+ 			</tns:Object>
+ 			<tns:Object order="10" type="index" name="IDX_OPTIONS_KEY" dependsOn="OPTIONS">
+ 				<tns:sql><![CDATA[CREATE INDEX idx_options_key on OPTIONS (TID)]]></tns:sql>
+ 			</tns:Object>
+ 			<tns:Object order="11" type="table" name="INDEXES">
+ 				<tns:sql><![CDATA[
+ 				CREATE TABLE INDEXES (
 -  				DB_ID INT NOT NULL REFERENCES DATABASES_ (DB_ID) ON DELETE CASCADE,
 -  				TID INT NOT NULL REFERENCES TABLES (TID) ON DELETE CASCADE,
 -  				INDEX_NAME VARCHAR(128) NOT NULL,
 -  				COLUMN_NAME VARCHAR(128) NOT NULL,
 -  				DATA_TYPE VARCHAR(128) NOT NULL,
 -  				INDEX_TYPE CHAR(32) NOT NULL,
 -  				IS_UNIQUE BOOLEAN NOT NULL,
 -  				IS_CLUSTERED BOOLEAN NOT NULL,
 -  				IS_ASCENDING BOOLEAN NOT NULL,
 -  				CONSTRAINT C_INDEXES_PK PRIMARY KEY (DB_ID, INDEX_NAME)
++				DB_ID INT NOT NULL REFERENCES DATABASES_ (DB_ID) ON DELETE CASCADE,
++				TID INT NOT NULL REFERENCES TABLES (TID) ON DELETE CASCADE,
++				INDEX_NAME VARCHAR(128) NOT NULL,
++				COLUMN_NAME VARCHAR(128) NOT NULL,
++				DATA_TYPE VARCHAR(128) NOT NULL,
++				INDEX_TYPE CHAR(32) NOT NULL,
++				PATH VARCHAR(4096),
++				IS_UNIQUE BOOLEAN NOT NULL,
++				IS_CLUSTERED BOOLEAN NOT NULL,
++				IS_ASCENDING BOOLEAN NOT NULL,
++				CONSTRAINT C_INDEXES_PK PRIMARY KEY (DB_ID, INDEX_NAME)
+ 				)]]>
+ 				</tns:sql>
+ 			</tns:Object>
+ 			<tns:Object order="12" type="index" name="IDX_INDEXES_PK" dependsOn="INDEXES">
+ 				<tns:sql><![CDATA[CREATE UNIQUE INDEX idx_indexes_pk ON INDEXES (DB_ID,index_name)]]></tns:sql>
+ 			</tns:Object>
+ 			<tns:Object order="13" type="index" name="IDX_INDEXES_COLUMNS" dependsOn="INDEXES">
 -				<tns:sql><![CDATA[CREATE INDEX idx_indexes_columns ON INDEXES (DB_ID,column_name)]]></tns:sql>
++				<tns:sql><![CDATA[CREATE INDEX idx_indexes_columns ON INDEXES (TID,column_name)]]></tns:sql>
+ 			</tns:Object>
+ 			<tns:Object order="14" type="table" name="STATS">
+ 				<tns:sql><![CDATA[
+ 				CREATE TABLE STATS (
+   				TID INT NOT NULL PRIMARY KEY,
+   				NUM_ROWS BIGINT,
+   				NUM_BYTES BIGINT,
+   				FOREIGN KEY (TID) REFERENCES TABLES (TID) ON DELETE CASCADE
+ 				)]]>
+ 				</tns:sql>
+ 			</tns:Object>
+ 			<tns:Object order="15" type="index" name="IDX_STATS_TABLE_NAME" dependsOn="STATS">
+ 				<tns:sql><![CDATA[CREATE UNIQUE INDEX IDX_STATS_TABLE_NAME ON STATS (TID)]]></tns:sql>
+ 			</tns:Object>
+ 			<tns:Object order="16" type="table" name="PARTITION_METHODS">
+ 				<tns:sql><![CDATA[
+ 				CREATE TABLE PARTITION_METHODS (
+   				TID INT NOT NULL REFERENCES TABLES (TID) ON DELETE CASCADE,
+   				PARTITION_TYPE VARCHAR(10) NOT NULL,
+   				EXPRESSION VARCHAR(1024) NOT NULL,
+   				EXPRESSION_SCHEMA VARCHAR(1024) FOR BIT DATA NOT NULL
+ 				)]]>
+ 				</tns:sql>
+ 			</tns:Object>
+ 			<tns:Object order="17" type="index" name="IDX_PARTITION_METHODS_TABLE_ID" dependsOn="PARTITION_METHODS">
+ 				<tns:sql><![CDATA[CREATE INDEX idx_partition_methods_table_id ON PARTITION_METHODS
(TID)]]></tns:sql>
+ 			</tns:Object>
+ 			<tns:Object name="PARTITIONS" type="table" order="18">
+ 				<tns:sql><![CDATA[
+ 				CREATE TABLE PARTITIONS (
+   				PID INT NOT NULL GENERATED ALWAYS AS IDENTITY (START WITH 1, INCREMENT BY 1),
+   				TID INT NOT NULL REFERENCES TABLES (TID) ON DELETE CASCADE,
+   				PARTITION_NAME VARCHAR(255),
+   				ORDINAL_POSITION INT NOT NULL,
+   				PARTITION_VALUE VARCHAR(1024),
+   				PATH VARCHAR(1024),
+   				CONSTRAINT C_PARTITION_PK PRIMARY KEY (PID),
+   				CONSTRAINT C_PARTITION_UNIQUE UNIQUE (TID, PARTITION_NAME)
+ 				)]]>
+ 				</tns:sql>
+ 			</tns:Object>
+ 			<tns:Object name="IDX_PARTITIONS_TABLE_NAME" type="index" dependsOn="PARTITIONS" order="19">
+ 				<tns:sql><![CDATA[CREATE INDEX idx_partitions_table_name ON PARTITIONS(TID)]]></tns:sql>
+ 			</tns:Object>
+ 		</tns:objects>
+ 	</tns:base>
+ 	<tns:existQueries>
+ 	  <tns:existQuery type="trigger">
+ 	    <tns:sql><![CDATA[
+ 	    select a.TRIGGERNAME from SYS.SYSTRIGGERS a
+ 	    ]]></tns:sql>
+ 	  </tns:existQuery>
+ 	  <tns:existQuery type="sequence">
+ 	    <tns:sql><![CDATA[
+ 	    select a.SEQUENCENAME from SYS.SYSSEQUENCES a
+ 	    ]]></tns:sql>
+ 	  </tns:existQuery>
+ 	  <tns:existQuery type="view">
+ 	    <tns:sql><![CDATA[
+ 	    select a.TABLENAME from SYS.SYSTABLES a where a.TABLETYPE = 'V'
+ 	    ]]></tns:sql>
+ 	  </tns:existQuery>
+ 	</tns:existQueries>
+ 	<tns:dropStatements>
+ 		<tns:dropStatement type="sequence">
+ 			<tns:sql><![CDATA[DROP SEQUENCE ? RESTRICT]]></tns:sql>
+ 		</tns:dropStatement>
+ 	</tns:dropStatements>
+ </tns:store>

http://git-wip-us.apache.org/repos/asf/tajo/blob/02b827e2/tajo-catalog/tajo-catalog-server/src/main/resources/schemas/oracle/oracle.xml
----------------------------------------------------------------------
diff --cc tajo-catalog/tajo-catalog-server/src/main/resources/schemas/oracle/oracle.xml
index 0000000,8945fca..50d1ab3
mode 000000,100644..100644
--- a/tajo-catalog/tajo-catalog-server/src/main/resources/schemas/oracle/oracle.xml
+++ b/tajo-catalog/tajo-catalog-server/src/main/resources/schemas/oracle/oracle.xml
@@@ -1,0 -1,218 +1,218 @@@
+ <?xml version="1.0" encoding="UTF-8"?>
+ <!--
+   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.
+   -->
+ <tns:store xmlns:tns="http://tajo.apache.org/catalogstore" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://tajo.apache.org/catalogstore ../DBMSSchemaDefinition.xsd ">
+   <tns:base version="2">
+     <tns:objects>
+   		<tns:Object order="0" type="table" name="meta">
+   			<tns:sql><![CDATA[
+   			CREATE TABLE META (VERSION INT NOT NULL)]]>
+   			</tns:sql>
+   		</tns:Object>
+   		<tns:Object order="1" type="table" name="tablespaces">
+   			<tns:sql><![CDATA[
+   			CREATE TABLE TABLESPACES (
+ 					SPACE_ID NUMBER(10) NOT NULL PRIMARY KEY,
+ 					SPACE_NAME VARCHAR2(128) NOT NULL UNIQUE,
+ 					SPACE_HANDLER VARCHAR2(1024) DEFAULT 'HDFS',
+ 					SPACE_URI VARCHAR2(4000) NOT NULL
+ 				)]]>
+ 				</tns:sql>
+   		</tns:Object>
+   		<tns:Object order="2" type="sequence" name="TABLESPACES_SEQ">
+   			<tns:sql><![CDATA[CREATE SEQUENCE TABLESPACES_SEQ]]></tns:sql>
+   		</tns:Object>
+   		<tns:Object order="3" type="trigger" name="TABLESPACES_AUTOINC">
+   			<tns:sql><![CDATA[
+   			CREATE OR REPLACE TRIGGER TABLESPACES_AUTOINC
+ 				BEFORE INSERT ON TABLESPACES
+ 				FOR EACH ROW
+ 				WHEN (new.SPACE_ID IS NULL)
+ 				BEGIN
+ 				  SELECT TABLESPACES_SEQ.NEXTVAL INTO :new.SPACE_ID FROM DUAL;
+ 				END;]]>
+ 				</tns:sql>
+   		</tns:Object>
+   		<tns:Object order="4" type="table" name="DATABASES_">
+   			<tns:sql><![CDATA[
+   			CREATE TABLE DATABASES_ (
+ 					DB_ID NUMBER(10) NOT NULL PRIMARY KEY,
+ 					DB_NAME VARCHAR2(128) NOT NULL UNIQUE,
+ 					SPACE_ID INT NOT NULL,
+ 					FOREIGN KEY (SPACE_ID) REFERENCES TABLESPACES (SPACE_ID)
+ 				)]]>
+ 				</tns:sql>
+   		</tns:Object>
+   		<tns:Object order="5" type="sequence" name="DATABASES__SEQ">
+   			<tns:sql><![CDATA[
+   			CREATE SEQUENCE DATABASES__SEQ
+   			]]>
+   			</tns:sql>
+   		</tns:Object>
+   		<tns:Object order="6" type="trigger" name="DATABASES__AUTOINC">
+   			<tns:sql><![CDATA[
+   			CREATE OR REPLACE TRIGGER DATABASES__AUTOINC
+ 				BEFORE INSERT ON DATABASES_
+ 				FOR EACH ROW
+ 				WHEN (new.DB_ID IS NULL)
+ 				BEGIN
+ 				  SELECT DATABASES__SEQ.NEXTVAL INTO :new.DB_ID FROM DUAL;
+ 				END;]]>
+ 				</tns:sql>
+   		</tns:Object>
+   		<tns:Object order="7" type="table" name="TABLES">
+   			<tns:sql><![CDATA[
+   			CREATE TABLE TABLES (
+ 					TID NUMBER(10) NOT NULL PRIMARY KEY,
+ 					DB_ID INT NOT NULL,
+ 					TABLE_NAME VARCHAR2(128) NOT NULL,
+ 					TABLE_TYPE VARCHAR2(128) NOT NULL,
+ 					PATH VARCHAR2(4000),
+ 					STORE_TYPE CHAR(16),
+ 					FOREIGN KEY (DB_ID) REFERENCES DATABASES_ (DB_ID)
+ 				)]]>
+ 				</tns:sql>
+   		</tns:Object>
+   		<tns:Object order="8" type="sequence" name="TABLES_SEQ">
+   			<tns:sql><![CDATA[
+   			CREATE SEQUENCE TABLES_SEQ
+   			]]>
+   			</tns:sql>
+   		</tns:Object>
+   		<tns:Object order="9" type="trigger" name="TABLES_AUTOINC">
+   			<tns:sql><![CDATA[
+   			CREATE OR REPLACE TRIGGER TABLES_AUTOINC
+ 				BEFORE INSERT ON TABLES
+ 				FOR EACH ROW
+ 				WHEN (new.TID IS NULL)
+ 				BEGIN
+ 				  SELECT TABLES_SEQ.NEXTVAL INTO :new.TID FROM DUAL;
+ 				END;]]>
+ 				</tns:sql>
+   		</tns:Object>
+   		<tns:Object order="10" type="index" name="TABLES_IDX_DB_ID" dependsOn="TABLES">
+   			<tns:sql><![CDATA[CREATE INDEX TABLES_IDX_DB_ID on TABLES (DB_ID)]]></tns:sql>
+   		</tns:Object>
+   		<tns:Object order="11" type="index" name="TABLES_IDX_TABLE_ID" dependsOn="TABLES">
+   			<tns:sql><![CDATA[CREATE UNIQUE INDEX TABLES_IDX_TABLE_ID on TABLES (DB_ID,
TABLE_NAME)]]></tns:sql>
+   		</tns:Object>
+   		<tns:Object order="12" type="table" name="COLUMNS">
+   			<tns:sql><![CDATA[
+   			CREATE TABLE COLUMNS (
+ 					TID INT NOT NULL,
+ 					COLUMN_NAME VARCHAR2(255) NOT NULL,
+ 					ORDINAL_POSITION INT NOT NULL,
+ 					DATA_TYPE CHAR(16),
+ 					TYPE_LENGTH INTEGER,
+ 					CONSTRAINT COLUMNS_PKEY PRIMARY KEY (TID, COLUMN_NAME),
+ 					FOREIGN KEY (TID) REFERENCES TABLES (TID) ON DELETE CASCADE
+ 				)]]>
+ 				</tns:sql>
+   		</tns:Object>
+   		<tns:Object order="13" type="table" name="OPTIONS">
+   			<tns:sql><![CDATA[
+   			CREATE TABLE OPTIONS (
+ 					TID INT NOT NULL,
+ 					KEY_ VARCHAR2(255) NOT NULL,
+ 					VALUE_ VARCHAR2(255) NOT NULL,
+ 					CONSTRAINT OPTIONS_PKEY PRIMARY KEY (TID, KEY_),
+ 					FOREIGN KEY (TID) REFERENCES TABLES (TID) ON DELETE CASCADE
+ 				)]]>
+ 				</tns:sql>
+   		</tns:Object>
+   		<tns:Object order="14" type="table" name="INDEXES">
+   			<tns:sql><![CDATA[
+   			CREATE TABLE INDEXES (
 -					DB_ID INT NOT NULL,
 -					TID INT NOT NULL,
 -					INDEX_NAME VARCHAR2(128) NOT NULL,
 -					COLUMN_NAME VARCHAR2(128) NOT NULL,
 -					DATA_TYPE VARCHAR2(128) NOT NULL,
 -					INDEX_TYPE CHAR(32) NOT NULL,
 -					IS_UNIQUE CHAR NOT NULL,
 -					IS_CLUSTERED CHAR NOT NULL,
 -					IS_ASCENDING CHAR NOT NULL,
 -					CONSTRAINT INDEXES_PKEY PRIMARY KEY (DB_ID, INDEX_NAME),
 -					FOREIGN KEY (DB_ID) REFERENCES DATABASES_ (DB_ID) ON DELETE CASCADE,
 -					FOREIGN KEY (TID) REFERENCES TABLES (TID) ON DELETE CASCADE
++  				DB_ID INT NOT NULL,
++  				TID INT NOT NULL,
++  				INDEX_NAME VARCHAR2(128) NOT NULL,
++  				COLUMN_NAME VARCHAR2(128) NOT NULL,
++  				DATA_TYPE VARCHAR2(128) NOT NULL,
++  				INDEX_TYPE CHAR(32) NOT NULL,
++  				IS_UNIQUE CHAR NOT NULL,
++  				IS_CLUSTERED CHAR NOT NULL,
++  				IS_ASCENDING CHAR NOT NULL,
++  				CONSTRAINT INDEXES_PKEY PRIMARY KEY (DB_ID, INDEX_NAME),
++  				FOREIGN KEY (DB_ID) REFERENCES DATABASES_ (DB_ID) ON DELETE CASCADE,
++  				FOREIGN KEY (TID) REFERENCES TABLES (TID) ON DELETE CASCADE
+ 				)]]>
+ 				</tns:sql>
+   		</tns:Object>
+   		<tns:Object order="15" type="index" name="INDEXES_IDX_TID_COLUMN_NAME" dependsOn="INDEXES">
+   			<tns:sql><![CDATA[CREATE INDEX INDEXES_IDX_TID_COLUMN_NAME on INDEXES (TID,
COLUMN_NAME)]]></tns:sql>
+   		</tns:Object>
+   		<tns:Object order="16" type="table" name="STATS">
+   			<tns:sql><![CDATA[
+   			CREATE TABLE STATS (
+ 					TID INT NOT NULL PRIMARY KEY,
+ 					NUM_ROWS NUMBER(38),
+ 					NUM_BYTES NUMBER(38),
+ 					FOREIGN KEY (TID) REFERENCES TABLES (TID) ON DELETE CASCADE
+ 				)]]>
+ 				</tns:sql>
+   		</tns:Object>
+   		<tns:Object order="17" type="table" name="PARTITION_METHODS">
+   			<tns:sql><![CDATA[
+   			CREATE TABLE PARTITION_METHODS (
+ 					TID INT NOT NULL PRIMARY KEY,
+ 					PARTITION_TYPE VARCHAR2(10) NOT NULL,
+ 					EXPRESSION VARCHAR2(1024) NOT NULL,
+ 					EXPRESSION_SCHEMA RAW(1024) NOT NULL,
+ 					FOREIGN KEY (TID) REFERENCES TABLES (TID) ON DELETE CASCADE
+ 				)]]>
+ 				</tns:sql>
+   		</tns:Object>
+   		<tns:Object order="18" type="table" name="PARTITIONS">
+   			<tns:sql><![CDATA[
+   			CREATE TABLE PARTITIONS (
+ 					PID INT NOT NULL PRIMARY KEY,
+ 					TID INT NOT NULL,
+ 					PARTITION_NAME VARCHAR2(128),
+ 					ORDINAL_POSITION INT NOT NULL,
+ 					PARTITION_VALUE VARCHAR2(1024),
+ 					PATH VARCHAR2(4000),
+ 					FOREIGN KEY (TID) REFERENCES TABLES (TID) ON DELETE CASCADE,
+ 					CONSTRAINT C_PARTITION_UNIQUE UNIQUE (TID, PARTITION_NAME)
+ 				)]]>
+ 				</tns:sql>
+   		</tns:Object>
+   		<tns:Object order="19" type="index" name="PARTITIONS_IDX_TID" dependsOn="PARTITIONS">
+   			<tns:sql><![CDATA[CREATE INDEX PARTITIONS_IDX_TID on PARTITIONS (TID)]]></tns:sql>
+   		</tns:Object>
+     </tns:objects>
+   </tns:base>
+   <tns:existQueries>
+   	<tns:existQuery type="trigger">
+   		<tns:sql><![CDATA[SELECT TRIGGER_NAME FROM USER_TRIGGERS]]></tns:sql>
+   	</tns:existQuery>
+   	<tns:existQuery type="sequence">
+   		<tns:sql><![CDATA[SELECT SEQUENCE_NAME FROM USER_SEQUENCES]]></tns:sql>
+   	</tns:existQuery>
+   	<tns:existQuery type="view">
+   		<tns:sql><![CDATA[SELECT VIEW_NAME FROM USER_VIEWS]]></tns:sql>
+   	</tns:existQuery>
+   	<tns:existQuery type="index">
+   		<tns:sql><![CDATA[SELECT INDEX_NAME FROM USER_INDEXES]]></tns:sql>
+   	</tns:existQuery>
+   </tns:existQueries>
+   <tns:dropStatements>
+   	<tns:dropStatement type="table">
+   		<tns:sql><![CDATA[DROP TABLE ? CASCADE CONSTRAINT]]></tns:sql>
+   	</tns:dropStatement>
+   </tns:dropStatements>
+ </tns:store>


Mime
View raw message