Commit 1902d5d1 authored by Cedric Caffy's avatar Cedric Caffy
Browse files

[Catalogue] Schema v4.0: adapted the catalogue for the tape lifecycle management

- NOT NULL CONSTRAINT on TAPE_STATE
- NOT NULL CONSTRAINT on STATE_UPDATE_TIME
- NOT NULL CONSTRAINT on STATE_MODIFIED_BY
- Removed the columns TAPE.IS_DISABLED and TAPE.IS_READ_ONLY and their
  constraints
parent 88838db7
......@@ -182,9 +182,7 @@ CREATE TABLE TAPE(
LAST_FSEQ BIGINT UNSIGNED CONSTRAINT TAPE_LF_NN NOT NULL,
NB_MASTER_FILES BIGINT UNSIGNED DEFAULT 0 CONSTRAINT TAPE_NB_MASTER_FILES_NN NOT NULL,
MASTER_DATA_IN_BYTES BIGINT UNSIGNED DEFAULT 0 CONSTRAINT TAPE_MASTER_DATA_IN_BYTES_NN NOT NULL,
IS_DISABLED CHAR(1),
IS_FULL CHAR(1) CONSTRAINT TAPE_IF_NN NOT NULL,
IS_READ_ONLY CHAR(1),
IS_FROM_CASTOR CHAR(1) CONSTRAINT TAPE_IFC_NN NOT NULL,
DIRTY CHAR(1) DEFAULT '1' CONSTRAINT TAPE_DIRTY_NN NOT NULL,
NB_COPY_NB_1 BIGINT UNSIGNED DEFAULT 0 CONSTRAINT TAPE_NB_COPY_NB_1_NN NOT NULL,
......@@ -200,10 +198,10 @@ CREATE TABLE TAPE(
READ_MOUNT_COUNT BIGINT UNSIGNED DEFAULT 0 CONSTRAINT TAPE_RMC_NN NOT NULL,
WRITE_MOUNT_COUNT BIGINT UNSIGNED DEFAULT 0 CONSTRAINT TAPE_WMC_NN NOT NULL,
USER_COMMENT VARCHAR(1000),
TAPE_STATE VARCHAR(100),
TAPE_STATE VARCHAR(100) CONSTRAINT TAPE_TS_NN NOT NULL,
STATE_REASON VARCHAR(1000),
STATE_UPDATE_TIME BIGINT UNSIGNED,
STATE_MODIFIED_BY VARCHAR(100),
STATE_UPDATE_TIME BIGINT UNSIGNED CONSTRAINT TAPE_SUT_NN NOT NULL,
STATE_MODIFIED_BY VARCHAR(100) CONSTRAINT TAPE_SMB_NN NOT NULL,
CREATION_LOG_USER_NAME VARCHAR(100) CONSTRAINT TAPE_CLUN_NN NOT NULL,
CREATION_LOG_HOST_NAME VARCHAR(100) CONSTRAINT TAPE_CLHN_NN NOT NULL,
CREATION_LOG_TIME BIGINT UNSIGNED CONSTRAINT TAPE_CLT_NN NOT NULL,
......@@ -213,16 +211,13 @@ CREATE TABLE TAPE(
CONSTRAINT TAPE_PK PRIMARY KEY(VID),
CONSTRAINT TAPE_LOGICAL_LIBRARY_FK FOREIGN KEY(LOGICAL_LIBRARY_ID) REFERENCES LOGICAL_LIBRARY(LOGICAL_LIBRARY_ID),
CONSTRAINT TAPE_TAPE_POOL_FK FOREIGN KEY(TAPE_POOL_ID) REFERENCES TAPE_POOL(TAPE_POOL_ID),
CONSTRAINT TAPE_IS_DISABLED_BOOL_CK CHECK(IS_DISABLED IN ('0', '1')),
CONSTRAINT TAPE_IS_FULL_BOOL_CK CHECK(IS_FULL IN ('0', '1')),
CONSTRAINT TAPE_IS_READ_ONLY_BOOL_CK CHECK(IS_READ_ONLY IN ('0', '1')),
CONSTRAINT TAPE_IS_FROM_CASTOR_BOOL_CK CHECK(IS_FROM_CASTOR IN ('0', '1')),
CONSTRAINT TAPE_DIRTY_BOOL_CK CHECK(DIRTY IN ('0','1')),
CONSTRAINT TAPE_STATE_CK CHECK(TAPE_STATE IN ('ACTIVE', 'DISABLED', 'BROKEN')),
CONSTRAINT TAPE_MEDIA_TYPE_FK FOREIGN KEY(MEDIA_TYPE_ID) REFERENCES MEDIA_TYPE(MEDIA_TYPE_ID)
);
CREATE INDEX TAPE_TAPE_POOL_ID_IDX ON TAPE(TAPE_POOL_ID);
CREATE INDEX TAPE_IS_DISABLED_IDX ON TAPE(IS_DISABLED);
CREATE INDEX TAPE_STATE_IDX ON TAPE(TAPE_STATE);
CREATE TABLE MOUNT_POLICY(
MOUNT_POLICY_NAME VARCHAR(100) CONSTRAINT MOUNT_POLICY_MPN_NN NOT NULL,
......
......@@ -214,9 +214,7 @@ CREATE TABLE TAPE(
LAST_FSEQ NUMERIC(20, 0) CONSTRAINT TAPE_LF_NN NOT NULL,
NB_MASTER_FILES NUMERIC(20, 0) DEFAULT 0 CONSTRAINT TAPE_NB_MASTER_FILES_NN NOT NULL,
MASTER_DATA_IN_BYTES NUMERIC(20, 0) DEFAULT 0 CONSTRAINT TAPE_MASTER_DATA_IN_BYTES_NN NOT NULL,
IS_DISABLED CHAR(1),
IS_FULL CHAR(1) CONSTRAINT TAPE_IF_NN NOT NULL,
IS_READ_ONLY CHAR(1),
IS_FROM_CASTOR CHAR(1) CONSTRAINT TAPE_IFC_NN NOT NULL,
DIRTY CHAR(1) DEFAULT '1' CONSTRAINT TAPE_DIRTY_NN NOT NULL,
NB_COPY_NB_1 NUMERIC(20, 0) DEFAULT 0 CONSTRAINT TAPE_NB_COPY_NB_1_NN NOT NULL,
......@@ -232,10 +230,10 @@ CREATE TABLE TAPE(
READ_MOUNT_COUNT NUMERIC(20, 0) DEFAULT 0 CONSTRAINT TAPE_RMC_NN NOT NULL,
WRITE_MOUNT_COUNT NUMERIC(20, 0) DEFAULT 0 CONSTRAINT TAPE_WMC_NN NOT NULL,
USER_COMMENT VARCHAR2(1000),
TAPE_STATE VARCHAR2(100),
TAPE_STATE VARCHAR2(100) CONSTRAINT TAPE_TS_NN NOT NULL,
STATE_REASON VARCHAR2(1000),
STATE_UPDATE_TIME NUMERIC(20, 0),
STATE_MODIFIED_BY VARCHAR2(100),
STATE_UPDATE_TIME NUMERIC(20, 0) CONSTRAINT TAPE_SUT_NN NOT NULL,
STATE_MODIFIED_BY VARCHAR2(100) CONSTRAINT TAPE_SMB_NN NOT NULL,
CREATION_LOG_USER_NAME VARCHAR2(100) CONSTRAINT TAPE_CLUN_NN NOT NULL,
CREATION_LOG_HOST_NAME VARCHAR2(100) CONSTRAINT TAPE_CLHN_NN NOT NULL,
CREATION_LOG_TIME NUMERIC(20, 0) CONSTRAINT TAPE_CLT_NN NOT NULL,
......@@ -245,16 +243,13 @@ CREATE TABLE TAPE(
CONSTRAINT TAPE_PK PRIMARY KEY(VID),
CONSTRAINT TAPE_LOGICAL_LIBRARY_FK FOREIGN KEY(LOGICAL_LIBRARY_ID) REFERENCES LOGICAL_LIBRARY(LOGICAL_LIBRARY_ID),
CONSTRAINT TAPE_TAPE_POOL_FK FOREIGN KEY(TAPE_POOL_ID) REFERENCES TAPE_POOL(TAPE_POOL_ID),
CONSTRAINT TAPE_IS_DISABLED_BOOL_CK CHECK(IS_DISABLED IN ('0', '1')),
CONSTRAINT TAPE_IS_FULL_BOOL_CK CHECK(IS_FULL IN ('0', '1')),
CONSTRAINT TAPE_IS_READ_ONLY_BOOL_CK CHECK(IS_READ_ONLY IN ('0', '1')),
CONSTRAINT TAPE_IS_FROM_CASTOR_BOOL_CK CHECK(IS_FROM_CASTOR IN ('0', '1')),
CONSTRAINT TAPE_DIRTY_BOOL_CK CHECK(DIRTY IN ('0','1')),
CONSTRAINT TAPE_STATE_CK CHECK(TAPE_STATE IN ('ACTIVE', 'DISABLED', 'BROKEN')),
CONSTRAINT TAPE_MEDIA_TYPE_FK FOREIGN KEY(MEDIA_TYPE_ID) REFERENCES MEDIA_TYPE(MEDIA_TYPE_ID)
);
CREATE INDEX TAPE_TAPE_POOL_ID_IDX ON TAPE(TAPE_POOL_ID);
CREATE INDEX TAPE_IS_DISABLED_IDX ON TAPE(IS_DISABLED);
CREATE INDEX TAPE_STATE_IDX ON TAPE(TAPE_STATE);
CREATE TABLE MOUNT_POLICY(
MOUNT_POLICY_NAME VARCHAR2(100) CONSTRAINT MOUNT_POLICY_MPN_NN NOT NULL,
......
......@@ -196,9 +196,7 @@ CREATE TABLE TAPE(
LAST_FSEQ NUMERIC(20, 0) CONSTRAINT TAPE_LF_NN NOT NULL,
NB_MASTER_FILES NUMERIC(20, 0) DEFAULT 0 CONSTRAINT TAPE_NB_MASTER_FILES_NN NOT NULL,
MASTER_DATA_IN_BYTES NUMERIC(20, 0) DEFAULT 0 CONSTRAINT TAPE_MASTER_DATA_IN_BYTES_NN NOT NULL,
IS_DISABLED CHAR(1),
IS_FULL CHAR(1) CONSTRAINT TAPE_IF_NN NOT NULL,
IS_READ_ONLY CHAR(1),
IS_FROM_CASTOR CHAR(1) CONSTRAINT TAPE_IFC_NN NOT NULL,
DIRTY CHAR(1) DEFAULT '1' CONSTRAINT TAPE_DIRTY_NN NOT NULL,
NB_COPY_NB_1 NUMERIC(20, 0) DEFAULT 0 CONSTRAINT TAPE_NB_COPY_NB_1_NN NOT NULL,
......@@ -214,10 +212,10 @@ CREATE TABLE TAPE(
READ_MOUNT_COUNT NUMERIC(20, 0) DEFAULT 0 CONSTRAINT TAPE_RMC_NN NOT NULL,
WRITE_MOUNT_COUNT NUMERIC(20, 0) DEFAULT 0 CONSTRAINT TAPE_WMC_NN NOT NULL,
USER_COMMENT VARCHAR(1000),
TAPE_STATE VARCHAR(100),
TAPE_STATE VARCHAR(100) CONSTRAINT TAPE_TS_NN NOT NULL,
STATE_REASON VARCHAR(1000),
STATE_UPDATE_TIME NUMERIC(20, 0),
STATE_MODIFIED_BY VARCHAR(100),
STATE_UPDATE_TIME NUMERIC(20, 0) CONSTRAINT TAPE_SUT_NN NOT NULL,
STATE_MODIFIED_BY VARCHAR(100) CONSTRAINT TAPE_SMB_NN NOT NULL,
CREATION_LOG_USER_NAME VARCHAR(100) CONSTRAINT TAPE_CLUN_NN NOT NULL,
CREATION_LOG_HOST_NAME VARCHAR(100) CONSTRAINT TAPE_CLHN_NN NOT NULL,
CREATION_LOG_TIME NUMERIC(20, 0) CONSTRAINT TAPE_CLT_NN NOT NULL,
......@@ -227,16 +225,13 @@ CREATE TABLE TAPE(
CONSTRAINT TAPE_PK PRIMARY KEY(VID),
CONSTRAINT TAPE_LOGICAL_LIBRARY_FK FOREIGN KEY(LOGICAL_LIBRARY_ID) REFERENCES LOGICAL_LIBRARY(LOGICAL_LIBRARY_ID),
CONSTRAINT TAPE_TAPE_POOL_FK FOREIGN KEY(TAPE_POOL_ID) REFERENCES TAPE_POOL(TAPE_POOL_ID),
CONSTRAINT TAPE_IS_DISABLED_BOOL_CK CHECK(IS_DISABLED IN ('0', '1')),
CONSTRAINT TAPE_IS_FULL_BOOL_CK CHECK(IS_FULL IN ('0', '1')),
CONSTRAINT TAPE_IS_READ_ONLY_BOOL_CK CHECK(IS_READ_ONLY IN ('0', '1')),
CONSTRAINT TAPE_IS_FROM_CASTOR_BOOL_CK CHECK(IS_FROM_CASTOR IN ('0', '1')),
CONSTRAINT TAPE_DIRTY_BOOL_CK CHECK(DIRTY IN ('0','1')),
CONSTRAINT TAPE_STATE_CK CHECK(TAPE_STATE IN ('ACTIVE', 'DISABLED', 'BROKEN')),
CONSTRAINT TAPE_MEDIA_TYPE_FK FOREIGN KEY(MEDIA_TYPE_ID) REFERENCES MEDIA_TYPE(MEDIA_TYPE_ID)
);
CREATE INDEX TAPE_TAPE_POOL_ID_IDX ON TAPE(TAPE_POOL_ID);
CREATE INDEX TAPE_IS_DISABLED_IDX ON TAPE(IS_DISABLED);
CREATE INDEX TAPE_STATE_IDX ON TAPE(TAPE_STATE);
CREATE TABLE MOUNT_POLICY(
MOUNT_POLICY_NAME VARCHAR(100) CONSTRAINT MOUNT_POLICY_MPN_NN NOT NULL,
......
......@@ -168,9 +168,7 @@ CREATE TABLE TAPE(
LAST_FSEQ INTEGER CONSTRAINT TAPE_LF_NN NOT NULL,
NB_MASTER_FILES INTEGER DEFAULT 0 CONSTRAINT TAPE_NB_MASTER_FILES_NN NOT NULL,
MASTER_DATA_IN_BYTES INTEGER DEFAULT 0 CONSTRAINT TAPE_MASTER_DATA_IN_BYTES_NN NOT NULL,
IS_DISABLED CHAR(1),
IS_FULL CHAR(1) CONSTRAINT TAPE_IF_NN NOT NULL,
IS_READ_ONLY CHAR(1),
IS_FROM_CASTOR CHAR(1) CONSTRAINT TAPE_IFC_NN NOT NULL,
DIRTY CHAR(1) DEFAULT '1' CONSTRAINT TAPE_DIRTY_NN NOT NULL,
NB_COPY_NB_1 INTEGER DEFAULT 0 CONSTRAINT TAPE_NB_COPY_NB_1_NN NOT NULL,
......@@ -186,10 +184,10 @@ CREATE TABLE TAPE(
READ_MOUNT_COUNT INTEGER DEFAULT 0 CONSTRAINT TAPE_RMC_NN NOT NULL,
WRITE_MOUNT_COUNT INTEGER DEFAULT 0 CONSTRAINT TAPE_WMC_NN NOT NULL,
USER_COMMENT VARCHAR(1000),
TAPE_STATE VARCHAR(100),
TAPE_STATE VARCHAR(100) CONSTRAINT TAPE_TS_NN NOT NULL,
STATE_REASON VARCHAR(1000),
STATE_UPDATE_TIME INTEGER,
STATE_MODIFIED_BY VARCHAR(100),
STATE_UPDATE_TIME INTEGER CONSTRAINT TAPE_SUT_NN NOT NULL,
STATE_MODIFIED_BY VARCHAR(100) CONSTRAINT TAPE_SMB_NN NOT NULL,
CREATION_LOG_USER_NAME VARCHAR(100) CONSTRAINT TAPE_CLUN_NN NOT NULL,
CREATION_LOG_HOST_NAME VARCHAR(100) CONSTRAINT TAPE_CLHN_NN NOT NULL,
CREATION_LOG_TIME INTEGER CONSTRAINT TAPE_CLT_NN NOT NULL,
......@@ -199,16 +197,13 @@ CREATE TABLE TAPE(
CONSTRAINT TAPE_PK PRIMARY KEY(VID),
CONSTRAINT TAPE_LOGICAL_LIBRARY_FK FOREIGN KEY(LOGICAL_LIBRARY_ID) REFERENCES LOGICAL_LIBRARY(LOGICAL_LIBRARY_ID),
CONSTRAINT TAPE_TAPE_POOL_FK FOREIGN KEY(TAPE_POOL_ID) REFERENCES TAPE_POOL(TAPE_POOL_ID),
CONSTRAINT TAPE_IS_DISABLED_BOOL_CK CHECK(IS_DISABLED IN ('0', '1')),
CONSTRAINT TAPE_IS_FULL_BOOL_CK CHECK(IS_FULL IN ('0', '1')),
CONSTRAINT TAPE_IS_READ_ONLY_BOOL_CK CHECK(IS_READ_ONLY IN ('0', '1')),
CONSTRAINT TAPE_IS_FROM_CASTOR_BOOL_CK CHECK(IS_FROM_CASTOR IN ('0', '1')),
CONSTRAINT TAPE_DIRTY_BOOL_CK CHECK(DIRTY IN ('0','1')),
CONSTRAINT TAPE_STATE_CK CHECK(TAPE_STATE IN ('ACTIVE', 'DISABLED', 'BROKEN')),
CONSTRAINT TAPE_MEDIA_TYPE_FK FOREIGN KEY(MEDIA_TYPE_ID) REFERENCES MEDIA_TYPE(MEDIA_TYPE_ID)
);
CREATE INDEX TAPE_TAPE_POOL_ID_IDX ON TAPE(TAPE_POOL_ID);
CREATE INDEX TAPE_IS_DISABLED_IDX ON TAPE(IS_DISABLED);
CREATE INDEX TAPE_STATE_IDX ON TAPE(TAPE_STATE);
CREATE TABLE MOUNT_POLICY(
MOUNT_POLICY_NAME VARCHAR(100) CONSTRAINT MOUNT_POLICY_MPN_NN NOT NULL,
......
......@@ -8902,9 +8902,7 @@ namespace catalogue{
" LAST_FSEQ NUMERIC(20, 0) CONSTRAINT TAPE_LF_NN NOT NULL,"
" NB_MASTER_FILES NUMERIC(20, 0) DEFAULT 0 CONSTRAINT TAPE_NB_MASTER_FILES_NN NOT NULL,"
" MASTER_DATA_IN_BYTES NUMERIC(20, 0) DEFAULT 0 CONSTRAINT TAPE_MASTER_DATA_IN_BYTES_NN NOT NULL,"
" IS_DISABLED CHAR(1),"
" IS_FULL CHAR(1) CONSTRAINT TAPE_IF_NN NOT NULL,"
" IS_READ_ONLY CHAR(1),"
" IS_FROM_CASTOR CHAR(1) CONSTRAINT TAPE_IFC_NN NOT NULL,"
" DIRTY CHAR(1) DEFAULT '1' CONSTRAINT TAPE_DIRTY_NN NOT NULL,"
" NB_COPY_NB_1 NUMERIC(20, 0) DEFAULT 0 CONSTRAINT TAPE_NB_COPY_NB_1_NN NOT NULL,"
......@@ -8920,10 +8918,10 @@ namespace catalogue{
" READ_MOUNT_COUNT NUMERIC(20, 0) DEFAULT 0 CONSTRAINT TAPE_RMC_NN NOT NULL,"
" WRITE_MOUNT_COUNT NUMERIC(20, 0) DEFAULT 0 CONSTRAINT TAPE_WMC_NN NOT NULL,"
" USER_COMMENT VARCHAR2(1000),"
" TAPE_STATE VARCHAR2(100),"
" TAPE_STATE VARCHAR2(100) CONSTRAINT TAPE_TS_NN NOT NULL,"
" STATE_REASON VARCHAR2(1000),"
" STATE_UPDATE_TIME NUMERIC(20, 0),"
" STATE_MODIFIED_BY VARCHAR2(100),"
" STATE_UPDATE_TIME NUMERIC(20, 0) CONSTRAINT TAPE_SUT_NN NOT NULL,"
" STATE_MODIFIED_BY VARCHAR2(100) CONSTRAINT TAPE_SMB_NN NOT NULL,"
" CREATION_LOG_USER_NAME VARCHAR2(100) CONSTRAINT TAPE_CLUN_NN NOT NULL,"
" CREATION_LOG_HOST_NAME VARCHAR2(100) CONSTRAINT TAPE_CLHN_NN NOT NULL,"
" CREATION_LOG_TIME NUMERIC(20, 0) CONSTRAINT TAPE_CLT_NN NOT NULL,"
......@@ -8933,16 +8931,13 @@ namespace catalogue{
" CONSTRAINT TAPE_PK PRIMARY KEY(VID),"
" CONSTRAINT TAPE_LOGICAL_LIBRARY_FK FOREIGN KEY(LOGICAL_LIBRARY_ID) REFERENCES LOGICAL_LIBRARY(LOGICAL_LIBRARY_ID),"
" CONSTRAINT TAPE_TAPE_POOL_FK FOREIGN KEY(TAPE_POOL_ID) REFERENCES TAPE_POOL(TAPE_POOL_ID),"
" CONSTRAINT TAPE_IS_DISABLED_BOOL_CK CHECK(IS_DISABLED IN ('0', '1')),"
" CONSTRAINT TAPE_IS_FULL_BOOL_CK CHECK(IS_FULL IN ('0', '1')),"
" CONSTRAINT TAPE_IS_READ_ONLY_BOOL_CK CHECK(IS_READ_ONLY IN ('0', '1')),"
" CONSTRAINT TAPE_IS_FROM_CASTOR_BOOL_CK CHECK(IS_FROM_CASTOR IN ('0', '1')),"
" CONSTRAINT TAPE_DIRTY_BOOL_CK CHECK(DIRTY IN ('0','1')),"
" CONSTRAINT TAPE_STATE_CK CHECK(TAPE_STATE IN ('ACTIVE', 'DISABLED', 'BROKEN')),"
" CONSTRAINT TAPE_MEDIA_TYPE_FK FOREIGN KEY(MEDIA_TYPE_ID) REFERENCES MEDIA_TYPE(MEDIA_TYPE_ID)"
");"
"CREATE INDEX TAPE_TAPE_POOL_ID_IDX ON TAPE(TAPE_POOL_ID);"
"CREATE INDEX TAPE_IS_DISABLED_IDX ON TAPE(IS_DISABLED);"
"CREATE INDEX TAPE_STATE_IDX ON TAPE(TAPE_STATE);"
"CREATE TABLE MOUNT_POLICY("
" MOUNT_POLICY_NAME VARCHAR2(100) CONSTRAINT MOUNT_POLICY_MPN_NN NOT NULL,"
......@@ -9265,9 +9260,7 @@ namespace catalogue{
" LAST_FSEQ BIGINT UNSIGNED CONSTRAINT TAPE_LF_NN NOT NULL,"
" NB_MASTER_FILES BIGINT UNSIGNED DEFAULT 0 CONSTRAINT TAPE_NB_MASTER_FILES_NN NOT NULL,"
" MASTER_DATA_IN_BYTES BIGINT UNSIGNED DEFAULT 0 CONSTRAINT TAPE_MASTER_DATA_IN_BYTES_NN NOT NULL,"
" IS_DISABLED CHAR(1),"
" IS_FULL CHAR(1) CONSTRAINT TAPE_IF_NN NOT NULL,"
" IS_READ_ONLY CHAR(1),"
" IS_FROM_CASTOR CHAR(1) CONSTRAINT TAPE_IFC_NN NOT NULL,"
" DIRTY CHAR(1) DEFAULT '1' CONSTRAINT TAPE_DIRTY_NN NOT NULL,"
" NB_COPY_NB_1 BIGINT UNSIGNED DEFAULT 0 CONSTRAINT TAPE_NB_COPY_NB_1_NN NOT NULL,"
......@@ -9283,10 +9276,10 @@ namespace catalogue{
" READ_MOUNT_COUNT BIGINT UNSIGNED DEFAULT 0 CONSTRAINT TAPE_RMC_NN NOT NULL,"
" WRITE_MOUNT_COUNT BIGINT UNSIGNED DEFAULT 0 CONSTRAINT TAPE_WMC_NN NOT NULL,"
" USER_COMMENT VARCHAR(1000),"
" TAPE_STATE VARCHAR(100),"
" TAPE_STATE VARCHAR(100) CONSTRAINT TAPE_TS_NN NOT NULL,"
" STATE_REASON VARCHAR(1000),"
" STATE_UPDATE_TIME BIGINT UNSIGNED,"
" STATE_MODIFIED_BY VARCHAR(100),"
" STATE_UPDATE_TIME BIGINT UNSIGNED CONSTRAINT TAPE_SUT_NN NOT NULL,"
" STATE_MODIFIED_BY VARCHAR(100) CONSTRAINT TAPE_SMB_NN NOT NULL,"
" CREATION_LOG_USER_NAME VARCHAR(100) CONSTRAINT TAPE_CLUN_NN NOT NULL,"
" CREATION_LOG_HOST_NAME VARCHAR(100) CONSTRAINT TAPE_CLHN_NN NOT NULL,"
" CREATION_LOG_TIME BIGINT UNSIGNED CONSTRAINT TAPE_CLT_NN NOT NULL,"
......@@ -9296,16 +9289,13 @@ namespace catalogue{
" CONSTRAINT TAPE_PK PRIMARY KEY(VID),"
" CONSTRAINT TAPE_LOGICAL_LIBRARY_FK FOREIGN KEY(LOGICAL_LIBRARY_ID) REFERENCES LOGICAL_LIBRARY(LOGICAL_LIBRARY_ID),"
" CONSTRAINT TAPE_TAPE_POOL_FK FOREIGN KEY(TAPE_POOL_ID) REFERENCES TAPE_POOL(TAPE_POOL_ID),"
" CONSTRAINT TAPE_IS_DISABLED_BOOL_CK CHECK(IS_DISABLED IN ('0', '1')),"
" CONSTRAINT TAPE_IS_FULL_BOOL_CK CHECK(IS_FULL IN ('0', '1')),"
" CONSTRAINT TAPE_IS_READ_ONLY_BOOL_CK CHECK(IS_READ_ONLY IN ('0', '1')),"
" CONSTRAINT TAPE_IS_FROM_CASTOR_BOOL_CK CHECK(IS_FROM_CASTOR IN ('0', '1')),"
" CONSTRAINT TAPE_DIRTY_BOOL_CK CHECK(DIRTY IN ('0','1')),"
" CONSTRAINT TAPE_STATE_CK CHECK(TAPE_STATE IN ('ACTIVE', 'DISABLED', 'BROKEN')),"
" CONSTRAINT TAPE_MEDIA_TYPE_FK FOREIGN KEY(MEDIA_TYPE_ID) REFERENCES MEDIA_TYPE(MEDIA_TYPE_ID)"
");"
"CREATE INDEX TAPE_TAPE_POOL_ID_IDX ON TAPE(TAPE_POOL_ID);"
"CREATE INDEX TAPE_IS_DISABLED_IDX ON TAPE(IS_DISABLED);"
"CREATE INDEX TAPE_STATE_IDX ON TAPE(TAPE_STATE);"
"CREATE TABLE MOUNT_POLICY("
" MOUNT_POLICY_NAME VARCHAR(100) CONSTRAINT MOUNT_POLICY_MPN_NN NOT NULL,"
......@@ -9613,9 +9603,7 @@ namespace catalogue{
" LAST_FSEQ INTEGER CONSTRAINT TAPE_LF_NN NOT NULL,"
" NB_MASTER_FILES INTEGER DEFAULT 0 CONSTRAINT TAPE_NB_MASTER_FILES_NN NOT NULL,"
" MASTER_DATA_IN_BYTES INTEGER DEFAULT 0 CONSTRAINT TAPE_MASTER_DATA_IN_BYTES_NN NOT NULL,"
" IS_DISABLED CHAR(1),"
" IS_FULL CHAR(1) CONSTRAINT TAPE_IF_NN NOT NULL,"
" IS_READ_ONLY CHAR(1),"
" IS_FROM_CASTOR CHAR(1) CONSTRAINT TAPE_IFC_NN NOT NULL,"
" DIRTY CHAR(1) DEFAULT '1' CONSTRAINT TAPE_DIRTY_NN NOT NULL,"
" NB_COPY_NB_1 INTEGER DEFAULT 0 CONSTRAINT TAPE_NB_COPY_NB_1_NN NOT NULL,"
......@@ -9631,10 +9619,10 @@ namespace catalogue{
" READ_MOUNT_COUNT INTEGER DEFAULT 0 CONSTRAINT TAPE_RMC_NN NOT NULL,"
" WRITE_MOUNT_COUNT INTEGER DEFAULT 0 CONSTRAINT TAPE_WMC_NN NOT NULL,"
" USER_COMMENT VARCHAR(1000),"
" TAPE_STATE VARCHAR(100),"
" TAPE_STATE VARCHAR(100) CONSTRAINT TAPE_TS_NN NOT NULL,"
" STATE_REASON VARCHAR(1000),"
" STATE_UPDATE_TIME INTEGER,"
" STATE_MODIFIED_BY VARCHAR(100),"
" STATE_UPDATE_TIME INTEGER CONSTRAINT TAPE_SUT_NN NOT NULL,"
" STATE_MODIFIED_BY VARCHAR(100) CONSTRAINT TAPE_SMB_NN NOT NULL,"
" CREATION_LOG_USER_NAME VARCHAR(100) CONSTRAINT TAPE_CLUN_NN NOT NULL,"
" CREATION_LOG_HOST_NAME VARCHAR(100) CONSTRAINT TAPE_CLHN_NN NOT NULL,"
" CREATION_LOG_TIME INTEGER CONSTRAINT TAPE_CLT_NN NOT NULL,"
......@@ -9644,16 +9632,13 @@ namespace catalogue{
" CONSTRAINT TAPE_PK PRIMARY KEY(VID),"
" CONSTRAINT TAPE_LOGICAL_LIBRARY_FK FOREIGN KEY(LOGICAL_LIBRARY_ID) REFERENCES LOGICAL_LIBRARY(LOGICAL_LIBRARY_ID),"
" CONSTRAINT TAPE_TAPE_POOL_FK FOREIGN KEY(TAPE_POOL_ID) REFERENCES TAPE_POOL(TAPE_POOL_ID),"
" CONSTRAINT TAPE_IS_DISABLED_BOOL_CK CHECK(IS_DISABLED IN ('0', '1')),"
" CONSTRAINT TAPE_IS_FULL_BOOL_CK CHECK(IS_FULL IN ('0', '1')),"
" CONSTRAINT TAPE_IS_READ_ONLY_BOOL_CK CHECK(IS_READ_ONLY IN ('0', '1')),"
" CONSTRAINT TAPE_IS_FROM_CASTOR_BOOL_CK CHECK(IS_FROM_CASTOR IN ('0', '1')),"
" CONSTRAINT TAPE_DIRTY_BOOL_CK CHECK(DIRTY IN ('0','1')),"
" CONSTRAINT TAPE_STATE_CK CHECK(TAPE_STATE IN ('ACTIVE', 'DISABLED', 'BROKEN')),"
" CONSTRAINT TAPE_MEDIA_TYPE_FK FOREIGN KEY(MEDIA_TYPE_ID) REFERENCES MEDIA_TYPE(MEDIA_TYPE_ID)"
");"
"CREATE INDEX TAPE_TAPE_POOL_ID_IDX ON TAPE(TAPE_POOL_ID);"
"CREATE INDEX TAPE_IS_DISABLED_IDX ON TAPE(IS_DISABLED);"
"CREATE INDEX TAPE_STATE_IDX ON TAPE(TAPE_STATE);"
"CREATE TABLE MOUNT_POLICY("
" MOUNT_POLICY_NAME VARCHAR(100) CONSTRAINT MOUNT_POLICY_MPN_NN NOT NULL,"
......@@ -9987,9 +9972,7 @@ namespace catalogue{
" LAST_FSEQ NUMERIC(20, 0) CONSTRAINT TAPE_LF_NN NOT NULL,"
" NB_MASTER_FILES NUMERIC(20, 0) DEFAULT 0 CONSTRAINT TAPE_NB_MASTER_FILES_NN NOT NULL,"
" MASTER_DATA_IN_BYTES NUMERIC(20, 0) DEFAULT 0 CONSTRAINT TAPE_MASTER_DATA_IN_BYTES_NN NOT NULL,"
" IS_DISABLED CHAR(1),"
" IS_FULL CHAR(1) CONSTRAINT TAPE_IF_NN NOT NULL,"
" IS_READ_ONLY CHAR(1),"
" IS_FROM_CASTOR CHAR(1) CONSTRAINT TAPE_IFC_NN NOT NULL,"
" DIRTY CHAR(1) DEFAULT '1' CONSTRAINT TAPE_DIRTY_NN NOT NULL,"
" NB_COPY_NB_1 NUMERIC(20, 0) DEFAULT 0 CONSTRAINT TAPE_NB_COPY_NB_1_NN NOT NULL,"
......@@ -10005,10 +9988,10 @@ namespace catalogue{
" READ_MOUNT_COUNT NUMERIC(20, 0) DEFAULT 0 CONSTRAINT TAPE_RMC_NN NOT NULL,"
" WRITE_MOUNT_COUNT NUMERIC(20, 0) DEFAULT 0 CONSTRAINT TAPE_WMC_NN NOT NULL,"
" USER_COMMENT VARCHAR(1000),"
" TAPE_STATE VARCHAR(100),"
" TAPE_STATE VARCHAR(100) CONSTRAINT TAPE_TS_NN NOT NULL,"
" STATE_REASON VARCHAR(1000),"
" STATE_UPDATE_TIME NUMERIC(20, 0),"
" STATE_MODIFIED_BY VARCHAR(100),"
" STATE_UPDATE_TIME NUMERIC(20, 0) CONSTRAINT TAPE_SUT_NN NOT NULL,"
" STATE_MODIFIED_BY VARCHAR(100) CONSTRAINT TAPE_SMB_NN NOT NULL,"
" CREATION_LOG_USER_NAME VARCHAR(100) CONSTRAINT TAPE_CLUN_NN NOT NULL,"
" CREATION_LOG_HOST_NAME VARCHAR(100) CONSTRAINT TAPE_CLHN_NN NOT NULL,"
" CREATION_LOG_TIME NUMERIC(20, 0) CONSTRAINT TAPE_CLT_NN NOT NULL,"
......@@ -10018,16 +10001,13 @@ namespace catalogue{
" CONSTRAINT TAPE_PK PRIMARY KEY(VID),"
" CONSTRAINT TAPE_LOGICAL_LIBRARY_FK FOREIGN KEY(LOGICAL_LIBRARY_ID) REFERENCES LOGICAL_LIBRARY(LOGICAL_LIBRARY_ID),"
" CONSTRAINT TAPE_TAPE_POOL_FK FOREIGN KEY(TAPE_POOL_ID) REFERENCES TAPE_POOL(TAPE_POOL_ID),"
" CONSTRAINT TAPE_IS_DISABLED_BOOL_CK CHECK(IS_DISABLED IN ('0', '1')),"
" CONSTRAINT TAPE_IS_FULL_BOOL_CK CHECK(IS_FULL IN ('0', '1')),"
" CONSTRAINT TAPE_IS_READ_ONLY_BOOL_CK CHECK(IS_READ_ONLY IN ('0', '1')),"
" CONSTRAINT TAPE_IS_FROM_CASTOR_BOOL_CK CHECK(IS_FROM_CASTOR IN ('0', '1')),"
" CONSTRAINT TAPE_DIRTY_BOOL_CK CHECK(DIRTY IN ('0','1')),"
" CONSTRAINT TAPE_STATE_CK CHECK(TAPE_STATE IN ('ACTIVE', 'DISABLED', 'BROKEN')),"
" CONSTRAINT TAPE_MEDIA_TYPE_FK FOREIGN KEY(MEDIA_TYPE_ID) REFERENCES MEDIA_TYPE(MEDIA_TYPE_ID)"
");"
"CREATE INDEX TAPE_TAPE_POOL_ID_IDX ON TAPE(TAPE_POOL_ID);"
"CREATE INDEX TAPE_IS_DISABLED_IDX ON TAPE(IS_DISABLED);"
"CREATE INDEX TAPE_STATE_IDX ON TAPE(TAPE_STATE);"
"CREATE TABLE MOUNT_POLICY("
" MOUNT_POLICY_NAME VARCHAR(100) CONSTRAINT MOUNT_POLICY_MPN_NN NOT NULL,"
......
......@@ -147,9 +147,7 @@ CREATE TABLE TAPE(
LAST_FSEQ UINT64TYPE CONSTRAINT TAPE_LF_NN NOT NULL,
NB_MASTER_FILES UINT64TYPE DEFAULT 0 CONSTRAINT TAPE_NB_MASTER_FILES_NN NOT NULL,
MASTER_DATA_IN_BYTES UINT64TYPE DEFAULT 0 CONSTRAINT TAPE_MASTER_DATA_IN_BYTES_NN NOT NULL,
IS_DISABLED CHAR(1),
IS_FULL CHAR(1) CONSTRAINT TAPE_IF_NN NOT NULL,
IS_READ_ONLY CHAR(1),
IS_FROM_CASTOR CHAR(1) CONSTRAINT TAPE_IFC_NN NOT NULL,
DIRTY CHAR(1) DEFAULT '1' CONSTRAINT TAPE_DIRTY_NN NOT NULL,
NB_COPY_NB_1 UINT64TYPE DEFAULT 0 CONSTRAINT TAPE_NB_COPY_NB_1_NN NOT NULL,
......@@ -165,10 +163,10 @@ CREATE TABLE TAPE(
READ_MOUNT_COUNT UINT64TYPE DEFAULT 0 CONSTRAINT TAPE_RMC_NN NOT NULL,
WRITE_MOUNT_COUNT UINT64TYPE DEFAULT 0 CONSTRAINT TAPE_WMC_NN NOT NULL,
USER_COMMENT VARCHAR(1000),
TAPE_STATE VARCHAR(100),
TAPE_STATE VARCHAR(100) CONSTRAINT TAPE_TS_NN NOT NULL,
STATE_REASON VARCHAR(1000),
STATE_UPDATE_TIME UINT64TYPE,
STATE_MODIFIED_BY VARCHAR(100),
STATE_UPDATE_TIME UINT64TYPE CONSTRAINT TAPE_SUT_NN NOT NULL,
STATE_MODIFIED_BY VARCHAR(100) CONSTRAINT TAPE_SMB_NN NOT NULL,
CREATION_LOG_USER_NAME VARCHAR(100) CONSTRAINT TAPE_CLUN_NN NOT NULL,
CREATION_LOG_HOST_NAME VARCHAR(100) CONSTRAINT TAPE_CLHN_NN NOT NULL,
CREATION_LOG_TIME UINT64TYPE CONSTRAINT TAPE_CLT_NN NOT NULL,
......@@ -178,16 +176,13 @@ CREATE TABLE TAPE(
CONSTRAINT TAPE_PK PRIMARY KEY(VID),
CONSTRAINT TAPE_LOGICAL_LIBRARY_FK FOREIGN KEY(LOGICAL_LIBRARY_ID) REFERENCES LOGICAL_LIBRARY(LOGICAL_LIBRARY_ID),
CONSTRAINT TAPE_TAPE_POOL_FK FOREIGN KEY(TAPE_POOL_ID) REFERENCES TAPE_POOL(TAPE_POOL_ID),
CONSTRAINT TAPE_IS_DISABLED_BOOL_CK CHECK(IS_DISABLED IN ('0', '1')),
CONSTRAINT TAPE_IS_FULL_BOOL_CK CHECK(IS_FULL IN ('0', '1')),
CONSTRAINT TAPE_IS_READ_ONLY_BOOL_CK CHECK(IS_READ_ONLY IN ('0', '1')),
CONSTRAINT TAPE_IS_FROM_CASTOR_BOOL_CK CHECK(IS_FROM_CASTOR IN ('0', '1')),
CONSTRAINT TAPE_DIRTY_BOOL_CK CHECK(DIRTY IN ('0','1')),
CONSTRAINT TAPE_STATE_CK CHECK(TAPE_STATE IN ('ACTIVE', 'DISABLED', 'BROKEN')),
CONSTRAINT TAPE_MEDIA_TYPE_FK FOREIGN KEY(MEDIA_TYPE_ID) REFERENCES MEDIA_TYPE(MEDIA_TYPE_ID)
);
CREATE INDEX TAPE_TAPE_POOL_ID_IDX ON TAPE(TAPE_POOL_ID);
CREATE INDEX TAPE_IS_DISABLED_IDX ON TAPE(IS_DISABLED);
CREATE INDEX TAPE_STATE_IDX ON TAPE(TAPE_STATE);
CREATE TABLE MOUNT_POLICY(
MOUNT_POLICY_NAME VARCHAR(100) CONSTRAINT MOUNT_POLICY_MPN_NN NOT NULL,
......
......@@ -109,6 +109,51 @@ DROP TABLE ARCHIVE_FILE_RECYCLE_BIN;
--changeset ccaffy:7 failOnError:true dbms:oracle
--preconditions onFail:HALT onError:HALT
--precondition-sql-check expectedResult:"3.2" SELECT CONCAT(CONCAT(CAST(SCHEMA_VERSION_MAJOR as VARCHAR(10)),'.'), CAST(SCHEMA_VERSION_MINOR AS VARCHAR(10))) AS CATALOGUE_VERSION FROM CTA_CATALOGUE;
ALTER TABLE TAPE MODIFY TAPE_STATE VARCHAR2(100) CONSTRAINT TAPE_TS_NN NOT NULL;
--rollback ALTER TABLE TAPE DROP CONSTRAINT TAPE_TS_NN;
--changeset ccaffy:8 failOnError:true dbms:oracle
--preconditions onFail:HALT onError:HALT
--precondition-sql-check expectedResult:"3.2" SELECT CONCAT(CONCAT(CAST(SCHEMA_VERSION_MAJOR as VARCHAR(10)),'.'), CAST(SCHEMA_VERSION_MINOR AS VARCHAR(10))) AS CATALOGUE_VERSION FROM CTA_CATALOGUE;
ALTER TABLE TAPE MODIFY STATE_UPDATE_TIME NUMERIC(20,0) CONSTRAINT TAPE_SUT_NN NOT NULL;
--rollback ALTER TABLE TAPE DROP CONSTRAINT TAPE_SUT_NN;
--changeset ccaffy:9 failOnError:true dbms:oracle
--preconditions onFail:HALT onError:HALT
--precondition-sql-check expectedResult:"3.2" SELECT CONCAT(CONCAT(CAST(SCHEMA_VERSION_MAJOR as VARCHAR(10)),'.'), CAST(SCHEMA_VERSION_MINOR AS VARCHAR(10))) AS CATALOGUE_VERSION FROM CTA_CATALOGUE;
ALTER TABLE TAPE MODIFY STATE_MODIFIED_BY VARCHAR2(100) CONSTRAINT TAPE_SMB_NN NOT NULL;
--rollback ALTER TABLE TAPE DROP CONSTRAINT TAPE_SMB_NN;
--changeset ccaffy:10 failOnError:true dbms:oracle
--preconditions onFail:HALT onError:HALT
--precondition-sql-check expectedResult:"3.2" SELECT CONCAT(CONCAT(CAST(SCHEMA_VERSION_MAJOR as VARCHAR(10)),'.'), CAST(SCHEMA_VERSION_MINOR AS VARCHAR(10))) AS CATALOGUE_VERSION FROM CTA_CATALOGUE;
ALTER TABLE TAPE DROP CONSTRAINT TAPE_IS_DISABLED_BOOL_CK;
--rollback ALTER TABLE TAPE ADD CONSTRAINT TAPE_IS_DISABLED_BOOL_CK CHECK(IS_DISABLED IN ('0', '1'));
--changeset ccaffy:11 failOnError:true dbms:oracle
--preconditions onFail:HALT onError:HALT
--precondition-sql-check expectedResult:"3.2" SELECT CONCAT(CONCAT(CAST(SCHEMA_VERSION_MAJOR as VARCHAR(10)),'.'), CAST(SCHEMA_VERSION_MINOR AS VARCHAR(10))) AS CATALOGUE_VERSION FROM CTA_CATALOGUE;
DROP INDEX TAPE_IS_DISABLED_IDX;
--rollback CREATE INDEX TAPE_IS_DISABLED_IDX ON TAPE(IS_DISABLED);
--changeset ccaffy:12 failOnError:true dbms:oracle
--preconditions onFail:HALT onError:HALT
--precondition-sql-check expectedResult:"3.2" SELECT CONCAT(CONCAT(CAST(SCHEMA_VERSION_MAJOR as VARCHAR(10)),'.'), CAST(SCHEMA_VERSION_MINOR AS VARCHAR(10))) AS CATALOGUE_VERSION FROM CTA_CATALOGUE;
ALTER TABLE TAPE DROP COLUMN IS_DISABLED;
--changeset ccaffy:13 failOnError:true dbms:oracle
--preconditions onFail:HALT onError:HALT
--precondition-sql-check expectedResult:"3.2" SELECT CONCAT(CONCAT(CAST(SCHEMA_VERSION_MAJOR as VARCHAR(10)),'.'), CAST(SCHEMA_VERSION_MINOR AS VARCHAR(10))) AS CATALOGUE_VERSION FROM CTA_CATALOGUE;
ALTER TABLE TAPE DROP CONSTRAINT TAPE_IS_READ_ONLY_BOOL_CK;
--changeset ccaffy:14 failOnError:true dbms:oracle
--preconditions onFail:HALT onError:HALT
--precondition-sql-check expectedResult:"3.2" SELECT CONCAT(CONCAT(CAST(SCHEMA_VERSION_MAJOR as VARCHAR(10)),'.'), CAST(SCHEMA_VERSION_MINOR AS VARCHAR(10))) AS CATALOGUE_VERSION FROM CTA_CATALOGUE;
ALTER TABLE TAPE DROP COLUMN IS_READ_ONLY;
--changeset ccaffy:15 failOnError:true dbms:oracle
--preconditions onFail:HALT onError:HALT
--precondition-sql-check expectedResult:"3.2" SELECT CONCAT(CONCAT(CAST(SCHEMA_VERSION_MAJOR as VARCHAR(10)),'.'), CAST(SCHEMA_VERSION_MINOR AS VARCHAR(10))) AS CATALOGUE_VERSION FROM CTA_CATALOGUE;
UPDATE CTA_CATALOGUE SET STATUS='PRODUCTION';
UPDATE CTA_CATALOGUE SET SCHEMA_VERSION_MAJOR=4;
UPDATE CTA_CATALOGUE SET SCHEMA_VERSION_MINOR=0;
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment