diff --git a/Makefile b/Makefile index df6b59c..a64c3bd 100644 --- a/Makefile +++ b/Makefile @@ -184,4 +184,4 @@ update-pkg-cache: .PHONY: golangci-lint golangci-lint: - @${GOBIN}/golangci-lint run --config=.github/linters/.golangci.yaml + @${GOBIN}/golangci-lint run -v --config=.github/linters/.golangci.yaml diff --git a/connector/connector.go b/connector/connector.go index 23ae897..bc21e5f 100644 --- a/connector/connector.go +++ b/connector/connector.go @@ -6,11 +6,13 @@ import ( "fmt" "net" "net/url" + "path/filepath" "strings" "github.com/go-sql-driver/mysql" "github.com/senzing-garage/go-databasing/connectormssql" "github.com/senzing-garage/go-databasing/connectormysql" + "github.com/senzing-garage/go-databasing/connectororacle" "github.com/senzing-garage/go-databasing/connectorpostgresql" "github.com/senzing-garage/go-databasing/connectorsqlite" ) @@ -150,6 +152,26 @@ func NewConnector(ctx context.Context, databaseURL string) (driver.Connector, er } result, err = connectormssql.NewConnector(ctx, configuration) + case "oracle": + // See https://pkg.go.dev/github.com/godror/godror + // databaseConnector, err = connectororacle.NewConnector(ctx, "user=sa;password=Passw0rd;database=master;server=localhost") + configurationMap := map[string]string{} + if len(username) > 0 { + configurationMap["user"] = username + } + if isPasswordSet { + configurationMap["password"] = password + } + configurationMap["connectString"] = fmt.Sprintf("%s:%s%s", host, port, filepath.Clean(path)) + for key, value := range query { + configurationMap[key] = value[0] + } + configuration := "" + for key, value := range configurationMap { + configuration += fmt.Sprintf("%s=%s ", key, value) + } + result, err = connectororacle.NewConnector(ctx, configuration) + default: err = fmt.Errorf("unknown database scheme: %s", scheme) } diff --git a/connectororacle/connectororacle_examples_test.go b/connectororacle/connectororacle_examples_test.go index 5e0ea9c..76e1676 100644 --- a/connectororacle/connectororacle_examples_test.go +++ b/connectororacle/connectororacle_examples_test.go @@ -12,9 +12,7 @@ import ( func ExampleNewConnector() { // For more information, visit https://github.com/senzing-garage/go-databasing/blob/main/connectormssql/connectororacle_examples_test.go ctx := context.TODO() - // See https://godror.github.io/godror/doc/connection.html // See https://pkg.go.dev/github.com/godror/godror - // configuration := `user="sysdba" password="Passw0rd" connectString="localhost:1521/FREEPDB1"` configuration := `user="sys" sysdba=true password="Passw0rd" connectString="localhost:1521/FREE"` databaseConnector, err := NewConnector(ctx, configuration) failOnError(err) diff --git a/connectororacle/connectororacle_test.go b/connectororacle/connectororacle_test.go index afc9cd0..fd1f6f0 100644 --- a/connectororacle/connectororacle_test.go +++ b/connectororacle/connectororacle_test.go @@ -13,7 +13,6 @@ import ( func TestNewConnector(test *testing.T) { ctx := context.TODO() - // configuration := `user="sysdba" password="Passw0rd" connectString="localhost:1521/FREEPDB1"` configuration := `user="sys" password="Passw0rd" sysdba=true noTimezoneCheck=true connectString="localhost:1521/FREE"` databaseConnector, err := NewConnector(ctx, configuration) require.NoError(test, err) diff --git a/docker-compose.yaml b/docker-compose.yaml index 928aa24..2aa7a28 100644 --- a/docker-compose.yaml +++ b/docker-compose.yaml @@ -123,8 +123,8 @@ services: ports: - 1521:1521 restart: always - volumes: - - ./testdata/oracle:/opt/oracle/scripts/startup + # volumes: + # - ./testdata/oracle:/opt/oracle/scripts/startup pgadmin: container_name: senzing-pgadmin diff --git a/docs/development.md b/docs/development.md index 68a54ff..9108c7b 100644 --- a/docs/development.md +++ b/docs/development.md @@ -52,6 +52,15 @@ These are "one-time tasks" which may already have been completed. ``` +## Environment variables + +1. Add to `LD_LIBRARY_PATH` for Oracle database. + Example: + + ```console + export LD_LIBRARY_PATH=${LD_LIBRARY_PATH}:/opt/oracle/instantclient_23_5 + ``` + ## Lint 1. Run linting. diff --git a/main.go b/main.go index 648ddd5..800dfc4 100644 --- a/main.go +++ b/main.go @@ -18,10 +18,11 @@ import ( // ---------------------------------------------------------------------------- const ( - Sqlite int = iota - Postgresql + Mssql int = iota Mysql - Mssql + Oracle + Postgresql + Sqlite ) // ---------------------------------------------------------------------------- @@ -29,18 +30,20 @@ const ( // ---------------------------------------------------------------------------- func main() { - databaseIDs := []int{Sqlite, Postgresql, Mysql, Mssql} + databaseIDs := []int{Oracle, Mssql, Mysql, Postgresql, Sqlite} printStatementTemplate := "\n==== %11s ==========================\n\n" for _, databaseID := range databaseIDs { switch databaseID { - case Sqlite: - fmt.Printf(printStatementTemplate, "Sqlite") - case Postgresql: - fmt.Printf(printStatementTemplate, "Postgresql") - case Mysql: - fmt.Printf(printStatementTemplate, "Mysql") case Mssql: fmt.Printf(printStatementTemplate, "Mssql") + case Mysql: + fmt.Printf(printStatementTemplate, "Mysql") + case Oracle: + fmt.Printf(printStatementTemplate, "Oracle") + case Postgresql: + fmt.Printf(printStatementTemplate, "Postgresql") + case Sqlite: + fmt.Printf(printStatementTemplate, "Sqlite") } demonstrateDatabase(databaseID) } @@ -73,13 +76,6 @@ func demonstrateDatabase(databaseID int) { // Construct database URL and choose SQL file. switch databaseID { - case Sqlite: - databaseURL = sqliteDatabaseURL - sqlFilename = gitRepositoryDir + "/testdata/sqlite/szcore-schema-sqlite-create.sql" - case Postgresql: - // See https://pkg.go.dev/github.com/lib/pq#hdr-Connection_String_Parameters - databaseURL = "postgresql://postgres:postgres@localhost/G2/?sslmode=disable" - sqlFilename = gitRepositoryDir + "/testdata/postgresql/szcore-schema-postgresql-create.sql" case Mysql: // See https://pkg.go.dev/github.com/go-sql-driver/mysql#Config databaseURL = "mysql://root:root@localhost/G2" // #nosec G101 @@ -88,6 +84,17 @@ func demonstrateDatabase(databaseID int) { // See https://github.com/microsoft/go-mssqldb#connection-parameters-and-dsn databaseURL = "mssql://sa:Passw0rd@localhost/master" sqlFilename = gitRepositoryDir + "/testdata/mssql/szcore-schema-mssql-create.sql" + case Oracle: + // See https://pkg.go.dev/github.com/godror/godror#pkg-overview + databaseURL = "oracle://sys:Passw0rd@localhost:1521/FREE/?sysdba=true&noTimezoneCheck=true" + sqlFilename = gitRepositoryDir + "/testdata/oracle/szcore-schema-oracle-create.sql" + case Postgresql: + // See https://pkg.go.dev/github.com/lib/pq#hdr-Connection_String_Parameters + databaseURL = "postgresql://postgres:postgres@localhost/G2/?sslmode=disable" + sqlFilename = gitRepositoryDir + "/testdata/postgresql/szcore-schema-postgresql-create.sql" + case Sqlite: + databaseURL = sqliteDatabaseURL + sqlFilename = gitRepositoryDir + "/testdata/sqlite/szcore-schema-sqlite-create.sql" default: exitOnError(fmt.Errorf("unknown databaseNumber: %d", databaseID)) } diff --git a/makefiles/linux.mk b/makefiles/linux.mk index 3012d58..af419cf 100644 --- a/makefiles/linux.mk +++ b/makefiles/linux.mk @@ -74,8 +74,7 @@ setup-osarch-specific: .PHONY: test-osarch-specific test-osarch-specific: - # @go test -json -v -p 1 ./... 2>&1 | tee /tmp/gotest.log | gotestfmt - @go test -json -v -p 1 ./connectororacle 2>&1 | tee /tmp/gotest.log | gotestfmt + @go test -json -v -p 1 ./... 2>&1 | tee /tmp/gotest.log | gotestfmt # ----------------------------------------------------------------------------- # Makefile targets supported only by this platform. diff --git a/sqlexecutor/main.go b/sqlexecutor/main.go index 38e7997..51fa062 100644 --- a/sqlexecutor/main.go +++ b/sqlexecutor/main.go @@ -45,7 +45,7 @@ var IDMessages = map[int]string{ 10: "Exit UnregisterObserver(%s) returned (%v).", 2000: "Entry: %+v", 2001: "Processed %d lines with no failures.", - 3001: "SQL.Exec failure number %d on line %d. Error: %v", + 3001: "SQL.Exec failure number %d on line %d. Result: %v; Error: %v", 3002: "Processed %d lines having %d failures.", 8001: "ProcessFileName", 8002: "ProcessScanner.Exec", diff --git a/testdata/oracle/szcore-schema-oracle-create.sql b/testdata/oracle/szcore-schema-oracle-create.sql index d4bc1b9..ecfb4dd 100644 --- a/testdata/oracle/szcore-schema-oracle-create.sql +++ b/testdata/oracle/szcore-schema-oracle-create.sql @@ -1,46 +1,46 @@ -CREATE TABLE LIB_FEAT (LIB_FEAT_ID NUMBER NOT NULL, FTYPE_ID NUMBER(5) NOT NULL, VERSION NUMBER(5) NOT NULL, FEAT_HASH VARCHAR2(40) NOT NULL, FEAT_DESC VARCHAR2(150), FELEM_VALUES CLOB NOT NULL, ANONYMIZED CHAR(1) NOT NULL) ; -ALTER TABLE LIB_FEAT ADD CONSTRAINT LIB_FEAT_PK PRIMARY KEY(LIB_FEAT_ID) USING INDEX; -CREATE UNIQUE INDEX LIB_FEAT_SK ON LIB_FEAT(FEAT_HASH, FTYPE_ID, ANONYMIZED) ; -CREATE TABLE SYS_HW_CHECK (LIB_FEAT_ID NUMBER NOT NULL, FTYPE_ID NUMBER(5) NOT NULL, VERSION NUMBER(5) NOT NULL, FEAT_HASH VARCHAR2(40) NOT NULL, FEAT_DESC VARCHAR2(150), FELEM_VALUES CLOB NOT NULL, ANONYMIZED CHAR(1) NOT NULL) ; -ALTER TABLE SYS_HW_CHECK ADD CONSTRAINT SYS_HW_CHECK_PK PRIMARY KEY(LIB_FEAT_ID) USING INDEX; -CREATE UNIQUE INDEX SYS_HW_CHECK_SK ON SYS_HW_CHECK(FEAT_HASH, FTYPE_ID, ANONYMIZED) ; -CREATE TABLE DSRC_RECORD (CONFIG_ID NUMBER, FIRST_SEEN_DT DATE, LAST_SEEN_DT DATE, RECORD_ID VARCHAR2(250) NOT NULL, ENT_SRC_KEY VARCHAR2(40) NOT NULL, DSRC_ID NUMBER(5) NOT NULL, JSON_DATA CLOB) ; -ALTER TABLE DSRC_RECORD ADD CONSTRAINT DSRC_RECORD_PK PRIMARY KEY(RECORD_ID, DSRC_ID) USING INDEX; -CREATE INDEX DSRC_RECORD_SK ON DSRC_RECORD(ENT_SRC_KEY, DSRC_ID) ; -CREATE TABLE OBS_ENT (OBS_ENT_ID NUMBER NOT NULL, LOCKING_ID NUMBER NOT NULL, LAST_TOUCH_DT NUMBER, DSRC_ID NUMBER(5) NOT NULL, LOCK_DSRC_ACTION CHAR(1), ENT_SRC_KEY VARCHAR2(40) NOT NULL, FEATURES CLOB) ; -ALTER TABLE OBS_ENT ADD CONSTRAINT OBS_ENT_PK PRIMARY KEY(OBS_ENT_ID) USING INDEX; -CREATE UNIQUE INDEX OBS_ENT_SK ON OBS_ENT(ENT_SRC_KEY, DSRC_ID) ; -CREATE TABLE RES_ENT (RES_ENT_ID NUMBER NOT NULL, LOCKING_ID NUMBER NOT NULL, LAST_TOUCH_DT NUMBER, ENT_STATE NUMBER, LOCK_DSRC_ACTION CHAR(1)) ; -ALTER TABLE RES_ENT ADD CONSTRAINT RES_ENT_PK PRIMARY KEY(RES_ENT_ID) USING INDEX; -CREATE TABLE RES_ENT_OKEY (OBS_ENT_ID NUMBER NOT NULL, RES_ENT_ID NUMBER NOT NULL, MATCH_KEY CLOB, ERRULE_ID NUMBER(5) NOT NULL) ; -ALTER TABLE RES_ENT_OKEY ADD CONSTRAINT RES_ENT_OKEY_PK PRIMARY KEY(OBS_ENT_ID) USING INDEX; -CREATE INDEX RES_ENT_OKEY_SK ON RES_ENT_OKEY(RES_ENT_ID, OBS_ENT_ID) ; -CREATE TABLE RES_FEAT_EKEY (RES_ENT_ID NUMBER NOT NULL, LIB_FEAT_ID NUMBER NOT NULL, OBS_ENT_CNT NUMBER, USED_FROM_DT DATE, USED_THRU_DT DATE, FTYPE_ID NUMBER(5) NOT NULL, SUPPRESSED CHAR(1), UTYPE_CODE VARCHAR2(255)) ; -CREATE UNIQUE INDEX RES_FEAT_EKEY_PK ON RES_FEAT_EKEY(LIB_FEAT_ID, RES_ENT_ID, UTYPE_CODE) ; -CREATE INDEX RES_FEAT_EKEY_SK ON RES_FEAT_EKEY(RES_ENT_ID) ; -CREATE TABLE RES_FEAT_STAT (LIB_FEAT_ID NUMBER NOT NULL, FTYPE_ID NUMBER(5) NOT NULL, NUM_RES_ENT NUMBER(7) NOT NULL, NUM_RES_ENT_OOM NUMBER(7) NOT NULL, CANDIDATE_CAP_REACHED CHAR(1) DEFAULT 'N' NOT NULL, SCORING_CAP_REACHED CHAR(1) DEFAULT 'N' NOT NULL) ; -ALTER TABLE RES_FEAT_STAT ADD CONSTRAINT RES_FEAT_STAT_PK PRIMARY KEY(LIB_FEAT_ID) USING INDEX; -CREATE TABLE RES_RELATE (RES_REL_ID NUMBER NOT NULL, MIN_RES_ENT_ID NUMBER NOT NULL, MAX_RES_ENT_ID NUMBER NOT NULL, LAST_ERRULE_ID NUMBER(5), IS_DISCLOSED NUMBER(1), IS_AMBIGUOUS NUMBER(1), MATCH_KEY CLOB, MATCH_KEY_DETAILS CLOB, MATCH_LEVELS VARCHAR2(50)) ; -ALTER TABLE RES_RELATE ADD CONSTRAINT RES_RELATE_PK PRIMARY KEY(RES_REL_ID) USING INDEX; -CREATE TABLE RES_REL_EKEY (RES_ENT_ID NUMBER NOT NULL, REL_ENT_ID NUMBER NOT NULL, RES_REL_ID NUMBER NOT NULL) ; -ALTER TABLE RES_REL_EKEY ADD CONSTRAINT RES_REL_EKEY_PK PRIMARY KEY(RES_ENT_ID, REL_ENT_ID) USING INDEX; -CREATE TABLE SYS_SEQUENCE (SEQUENCE_NAME VARCHAR2(50) NOT NULL, NEXT_SEQUENCE NUMBER NOT NULL, CACHE_SIZE NUMBER NOT NULL) ; -ALTER TABLE SYS_SEQUENCE ADD CONSTRAINT SYS_SEQUENCE_PK PRIMARY KEY(SEQUENCE_NAME) USING INDEX; -INSERT INTO SYS_SEQUENCE (SEQUENCE_NAME,NEXT_SEQUENCE,CACHE_SIZE) VALUES ('ER_ID',1,100000); -INSERT INTO SYS_SEQUENCE (SEQUENCE_NAME,NEXT_SEQUENCE,CACHE_SIZE) VALUES ('LIB_FEAT_ID',1,100000); -INSERT INTO SYS_SEQUENCE (SEQUENCE_NAME,NEXT_SEQUENCE,CACHE_SIZE) VALUES ('OBS_ENT_ID',1,100000); -INSERT INTO SYS_SEQUENCE (SEQUENCE_NAME,NEXT_SEQUENCE,CACHE_SIZE) VALUES ('OBS_ID',1,100000); -INSERT INTO SYS_SEQUENCE (SEQUENCE_NAME,NEXT_SEQUENCE,CACHE_SIZE) VALUES ('RES_REL_ID',1,100000); -CREATE TABLE SYS_CFG (CONFIG_DATA_ID NUMBER NOT NULL, CONFIG_DATA CLOB NOT NULL, CONFIG_COMMENTS VARCHAR2(200) NOT NULL, SYS_CREATE_DT DATE NOT NULL) ; -ALTER TABLE SYS_CFG ADD CONSTRAINT SYS_CFG_PK PRIMARY KEY(CONFIG_DATA_ID) USING INDEX; -CREATE TABLE SYS_CODES_USED (CODE_TYPE VARCHAR2(25) NOT NULL, CODE VARCHAR2(25) NOT NULL, CODE_ID NUMBER NOT NULL) ; -ALTER TABLE SYS_CODES_USED ADD CONSTRAINT SYS_CODES_USED_PK PRIMARY KEY(CODE_TYPE, CODE) USING INDEX; -CREATE UNIQUE INDEX SYS_CODES_USED_SK ON SYS_CODES_USED(CODE_TYPE, CODE_ID) ; -CREATE TABLE SYS_VARS (VAR_GROUP VARCHAR2(25) NOT NULL, VAR_CODE VARCHAR2(25) NOT NULL, VAR_VALUE VARCHAR2(25) NOT NULL, SYS_LSTUPD_DT DATE) ; -ALTER TABLE SYS_VARS ADD CONSTRAINT SYS_VARS_PK PRIMARY KEY(VAR_GROUP, VAR_CODE) USING INDEX; -INSERT INTO SYS_VARS (VAR_GROUP,VAR_CODE,VAR_VALUE) VALUES ('VERSION','SCHEMA','4.0'); -CREATE TABLE SYS_STATUS (SYSTEM_CODE VARCHAR2(50) NOT NULL, LAST_TOUCH_DT DATE) ; -ALTER TABLE SYS_STATUS ADD CONSTRAINT SYS_STATUS_PK PRIMARY KEY(SYSTEM_CODE) USING INDEX; -CREATE TABLE SYS_EVAL_QUEUE (MSG_ID NUMBER NOT NULL, DSRC_CODE VARCHAR2(25) NOT NULL, ENT_SRC_KEY VARCHAR2(40) NOT NULL, MSG CLOB) ; -ALTER TABLE SYS_EVAL_QUEUE ADD CONSTRAINT SYS_EVAL_QUEUE_PK PRIMARY KEY(MSG_ID) USING INDEX; -CREATE UNIQUE INDEX IX_EVAL_QUEUE ON SYS_EVAL_QUEUE(ENT_SRC_KEY, DSRC_CODE) ; +CREATE TABLE LIB_FEAT (LIB_FEAT_ID NUMBER NOT NULL, FTYPE_ID NUMBER(5) NOT NULL, VERSION NUMBER(5) NOT NULL, FEAT_HASH VARCHAR2(40) NOT NULL, FEAT_DESC VARCHAR2(150), FELEM_VALUES CLOB NOT NULL, ANONYMIZED CHAR(1) NOT NULL) +ALTER TABLE LIB_FEAT ADD CONSTRAINT LIB_FEAT_PK PRIMARY KEY(LIB_FEAT_ID) USING INDEX +CREATE UNIQUE INDEX LIB_FEAT_SK ON LIB_FEAT(FEAT_HASH, FTYPE_ID, ANONYMIZED) +CREATE TABLE SYS_HW_CHECK (LIB_FEAT_ID NUMBER NOT NULL, FTYPE_ID NUMBER(5) NOT NULL, VERSION NUMBER(5) NOT NULL, FEAT_HASH VARCHAR2(40) NOT NULL, FEAT_DESC VARCHAR2(150), FELEM_VALUES CLOB NOT NULL, ANONYMIZED CHAR(1) NOT NULL) +ALTER TABLE SYS_HW_CHECK ADD CONSTRAINT SYS_HW_CHECK_PK PRIMARY KEY(LIB_FEAT_ID) USING INDEX +CREATE UNIQUE INDEX SYS_HW_CHECK_SK ON SYS_HW_CHECK(FEAT_HASH, FTYPE_ID, ANONYMIZED) +CREATE TABLE DSRC_RECORD (CONFIG_ID NUMBER, FIRST_SEEN_DT DATE, LAST_SEEN_DT DATE, RECORD_ID VARCHAR2(250) NOT NULL, ENT_SRC_KEY VARCHAR2(40) NOT NULL, DSRC_ID NUMBER(5) NOT NULL, JSON_DATA CLOB) +ALTER TABLE DSRC_RECORD ADD CONSTRAINT DSRC_RECORD_PK PRIMARY KEY(RECORD_ID, DSRC_ID) USING INDEX +CREATE INDEX DSRC_RECORD_SK ON DSRC_RECORD(ENT_SRC_KEY, DSRC_ID) +CREATE TABLE OBS_ENT (OBS_ENT_ID NUMBER NOT NULL, LOCKING_ID NUMBER NOT NULL, LAST_TOUCH_DT NUMBER, DSRC_ID NUMBER(5) NOT NULL, LOCK_DSRC_ACTION CHAR(1), ENT_SRC_KEY VARCHAR2(40) NOT NULL, FEATURES CLOB) +ALTER TABLE OBS_ENT ADD CONSTRAINT OBS_ENT_PK PRIMARY KEY(OBS_ENT_ID) USING INDEX +CREATE UNIQUE INDEX OBS_ENT_SK ON OBS_ENT(ENT_SRC_KEY, DSRC_ID) +CREATE TABLE RES_ENT (RES_ENT_ID NUMBER NOT NULL, LOCKING_ID NUMBER NOT NULL, LAST_TOUCH_DT NUMBER, ENT_STATE NUMBER, LOCK_DSRC_ACTION CHAR(1)) +ALTER TABLE RES_ENT ADD CONSTRAINT RES_ENT_PK PRIMARY KEY(RES_ENT_ID) USING INDEX +CREATE TABLE RES_ENT_OKEY (OBS_ENT_ID NUMBER NOT NULL, RES_ENT_ID NUMBER NOT NULL, MATCH_KEY CLOB, ERRULE_ID NUMBER(5) NOT NULL) +ALTER TABLE RES_ENT_OKEY ADD CONSTRAINT RES_ENT_OKEY_PK PRIMARY KEY(OBS_ENT_ID) USING INDEX +CREATE INDEX RES_ENT_OKEY_SK ON RES_ENT_OKEY(RES_ENT_ID, OBS_ENT_ID) +CREATE TABLE RES_FEAT_EKEY (RES_ENT_ID NUMBER NOT NULL, LIB_FEAT_ID NUMBER NOT NULL, OBS_ENT_CNT NUMBER, USED_FROM_DT DATE, USED_THRU_DT DATE, FTYPE_ID NUMBER(5) NOT NULL, SUPPRESSED CHAR(1), UTYPE_CODE VARCHAR2(255)) +CREATE UNIQUE INDEX RES_FEAT_EKEY_PK ON RES_FEAT_EKEY(LIB_FEAT_ID, RES_ENT_ID, UTYPE_CODE) +CREATE INDEX RES_FEAT_EKEY_SK ON RES_FEAT_EKEY(RES_ENT_ID) +CREATE TABLE RES_FEAT_STAT (LIB_FEAT_ID NUMBER NOT NULL, FTYPE_ID NUMBER(5) NOT NULL, NUM_RES_ENT NUMBER(7) NOT NULL, NUM_RES_ENT_OOM NUMBER(7) NOT NULL, CANDIDATE_CAP_REACHED CHAR(1) DEFAULT 'N' NOT NULL, SCORING_CAP_REACHED CHAR(1) DEFAULT 'N' NOT NULL) +ALTER TABLE RES_FEAT_STAT ADD CONSTRAINT RES_FEAT_STAT_PK PRIMARY KEY(LIB_FEAT_ID) USING INDEX +CREATE TABLE RES_RELATE (RES_REL_ID NUMBER NOT NULL, MIN_RES_ENT_ID NUMBER NOT NULL, MAX_RES_ENT_ID NUMBER NOT NULL, LAST_ERRULE_ID NUMBER(5), IS_DISCLOSED NUMBER(1), IS_AMBIGUOUS NUMBER(1), MATCH_KEY CLOB, MATCH_KEY_DETAILS CLOB, MATCH_LEVELS VARCHAR2(50)) +ALTER TABLE RES_RELATE ADD CONSTRAINT RES_RELATE_PK PRIMARY KEY(RES_REL_ID) USING INDEX +CREATE TABLE RES_REL_EKEY (RES_ENT_ID NUMBER NOT NULL, REL_ENT_ID NUMBER NOT NULL, RES_REL_ID NUMBER NOT NULL) +ALTER TABLE RES_REL_EKEY ADD CONSTRAINT RES_REL_EKEY_PK PRIMARY KEY(RES_ENT_ID, REL_ENT_ID) USING INDEX +CREATE TABLE SYS_SEQUENCE (SEQUENCE_NAME VARCHAR2(50) NOT NULL, NEXT_SEQUENCE NUMBER NOT NULL, CACHE_SIZE NUMBER NOT NULL) +ALTER TABLE SYS_SEQUENCE ADD CONSTRAINT SYS_SEQUENCE_PK PRIMARY KEY(SEQUENCE_NAME) USING INDEX +INSERT INTO SYS_SEQUENCE (SEQUENCE_NAME,NEXT_SEQUENCE,CACHE_SIZE) VALUES ('ER_ID',1,100000) +INSERT INTO SYS_SEQUENCE (SEQUENCE_NAME,NEXT_SEQUENCE,CACHE_SIZE) VALUES ('LIB_FEAT_ID',1,100000) +INSERT INTO SYS_SEQUENCE (SEQUENCE_NAME,NEXT_SEQUENCE,CACHE_SIZE) VALUES ('OBS_ENT_ID',1,100000) +INSERT INTO SYS_SEQUENCE (SEQUENCE_NAME,NEXT_SEQUENCE,CACHE_SIZE) VALUES ('OBS_ID',1,100000) +INSERT INTO SYS_SEQUENCE (SEQUENCE_NAME,NEXT_SEQUENCE,CACHE_SIZE) VALUES ('RES_REL_ID',1,100000) +CREATE TABLE SYS_CFG (CONFIG_DATA_ID NUMBER NOT NULL, CONFIG_DATA CLOB NOT NULL, CONFIG_COMMENTS VARCHAR2(200) NOT NULL, SYS_CREATE_DT DATE NOT NULL) +ALTER TABLE SYS_CFG ADD CONSTRAINT SYS_CFG_PK PRIMARY KEY(CONFIG_DATA_ID) USING INDEX +CREATE TABLE SYS_CODES_USED (CODE_TYPE VARCHAR2(25) NOT NULL, CODE VARCHAR2(25) NOT NULL, CODE_ID NUMBER NOT NULL) +ALTER TABLE SYS_CODES_USED ADD CONSTRAINT SYS_CODES_USED_PK PRIMARY KEY(CODE_TYPE, CODE) USING INDEX +CREATE UNIQUE INDEX SYS_CODES_USED_SK ON SYS_CODES_USED(CODE_TYPE, CODE_ID) +CREATE TABLE SYS_VARS (VAR_GROUP VARCHAR2(25) NOT NULL, VAR_CODE VARCHAR2(25) NOT NULL, VAR_VALUE VARCHAR2(25) NOT NULL, SYS_LSTUPD_DT DATE) +ALTER TABLE SYS_VARS ADD CONSTRAINT SYS_VARS_PK PRIMARY KEY(VAR_GROUP, VAR_CODE) USING INDEX +INSERT INTO SYS_VARS (VAR_GROUP,VAR_CODE,VAR_VALUE) VALUES ('VERSION','SCHEMA','4.0') +CREATE TABLE SYS_STATUS (SYSTEM_CODE VARCHAR2(50) NOT NULL, LAST_TOUCH_DT DATE) +ALTER TABLE SYS_STATUS ADD CONSTRAINT SYS_STATUS_PK PRIMARY KEY(SYSTEM_CODE) USING INDEX +CREATE TABLE SYS_EVAL_QUEUE (MSG_ID NUMBER NOT NULL, DSRC_CODE VARCHAR2(25) NOT NULL, ENT_SRC_KEY VARCHAR2(40) NOT NULL, MSG CLOB) +ALTER TABLE SYS_EVAL_QUEUE ADD CONSTRAINT SYS_EVAL_QUEUE_PK PRIMARY KEY(MSG_ID) USING INDEX +CREATE UNIQUE INDEX IX_EVAL_QUEUE ON SYS_EVAL_QUEUE(ENT_SRC_KEY, DSRC_CODE)