Commit 204a4b74 authored by Cedric CAFFY's avatar Cedric CAFFY
Browse files

Created transition schema 1.2 for doing a migration from schema 1.1 to schema 2.0

parent f7a784c7
......@@ -18,7 +18,11 @@ CREATE TABLE TAPE_POOL_ID(
CONSTRAINT TAPE_POOL_ID_PK PRIMARY KEY(ID)
);
INSERT INTO TAPE_POOL_ID(ID) VALUES(1);
CREATE TABLE VIRTUAL_ORGANIZATION_ID(
ID BIGINT UNSIGNED,
CONSTRAINT VIRTUAL_ORGANIZATION_ID_PK PRIMARY KEY(ID)
);
INSERT INTO VIRTUAL_ORGANIZATION_ID(ID) VALUES(1);
CREATE TABLE CTA_CATALOGUE(
SCHEMA_VERSION_MAJOR BIGINT UNSIGNED CONSTRAINT CTA_CATALOGUE_SVM1_NN NOT NULL,
SCHEMA_VERSION_MINOR BIGINT UNSIGNED CONSTRAINT CTA_CATALOGUE_SVM2_NN NOT NULL,
......@@ -53,11 +57,18 @@ CREATE TABLE DISK_SYSTEM(
LAST_UPDATE_TIME BIGINT UNSIGNED CONSTRAINT DISK_SYSTEM_LUT_NN NOT NULL,
CONSTRAINT NAME_PK PRIMARY KEY(DISK_SYSTEM_NAME)
);
CREATE TABLE VIRTUAL_ORGANIZATION(
VIRTUAL_ORGANIZATION_ID BIGINT UNSIGNED CONSTRAINT VIRTUAL_ORGANIZATION_VOI_NN NOT NULL,
VIRTUAL_ORGANIZATION_NAME VARCHAR(100) CONSTRAINT VIRTUAL_ORGANIZATION_VON_NN NOT NULL,
CONSTRAINT VIRTUAL_ORGANIZATION_PK PRIMARY KEY(VIRTUAL_ORGANIZATION_ID),
CONSTRAINT VIRTUAL_ORGANIZATION_VON_UN UNIQUE(VIRTUAL_ORGANIZATION_NAME)
);
CREATE TABLE STORAGE_CLASS(
STORAGE_CLASS_ID BIGINT UNSIGNED CONSTRAINT STORAGE_CLASS_SCI_NN NOT NULL,
DISK_INSTANCE_NAME VARCHAR(100) CONSTRAINT STORAGE_CLASS_DIN_NN NOT NULL,
STORAGE_CLASS_NAME VARCHAR(100) CONSTRAINT STORAGE_CLASS_SCN_NN NOT NULL,
NB_COPIES TINYINT UNSIGNED CONSTRAINT STORAGE_CLASS_NC_NN NOT NULL,
VIRTUAL_ORGANIZATION_ID BIGINT UNSIGNED,
USER_COMMENT VARCHAR(1000) CONSTRAINT STORAGE_CLASS_UC_NN NOT NULL,
CREATION_LOG_USER_NAME VARCHAR(100) CONSTRAINT STORAGE_CLASS_CLUN_NN NOT NULL,
CREATION_LOG_HOST_NAME VARCHAR(100) CONSTRAINT STORAGE_CLASS_CLHN_NN NOT NULL,
......@@ -66,7 +77,8 @@ CREATE TABLE STORAGE_CLASS(
LAST_UPDATE_HOST_NAME VARCHAR(100) CONSTRAINT STORAGE_CLASS_LUHN_NN NOT NULL,
LAST_UPDATE_TIME BIGINT UNSIGNED CONSTRAINT STORAGE_CLASS_LUT_NN NOT NULL,
CONSTRAINT STORAGE_CLASS_PK PRIMARY KEY(STORAGE_CLASS_ID),
CONSTRAINT STORAGE_CLASS_SCN_UN UNIQUE(STORAGE_CLASS_NAME)
CONSTRAINT STORAGE_CLASS_SCN_UN UNIQUE(STORAGE_CLASS_NAME),
CONSTRAINT STORAGE_CLASS_VOI_FK FOREIGN KEY(VIRTUAL_ORGANIZATION_ID) REFERENCES VIRTUAL_ORGANIZATION(VIRTUAL_ORGANIZATION_ID)
);
CREATE TABLE TAPE_POOL(
TAPE_POOL_ID BIGINT UNSIGNED CONSTRAINT TAPE_POOL_TPI_NN NOT NULL,
......@@ -75,6 +87,7 @@ CREATE TABLE TAPE_POOL(
NB_PARTIAL_TAPES BIGINT UNSIGNED CONSTRAINT TAPE_POOL_NPT_NN NOT NULL,
IS_ENCRYPTED CHAR(1) CONSTRAINT TAPE_POOL_IE_NN NOT NULL,
SUPPLY VARCHAR(100),
VIRTUAL_ORGANIZATION_ID BIGINT UNSIGNED,
USER_COMMENT VARCHAR(1000) CONSTRAINT TAPE_POOL_UC_NN NOT NULL,
CREATION_LOG_USER_NAME VARCHAR(100) CONSTRAINT TAPE_POOL_CLUN_NN NOT NULL,
CREATION_LOG_HOST_NAME VARCHAR(100) CONSTRAINT TAPE_POOL_CLHN_NN NOT NULL,
......@@ -84,7 +97,8 @@ CREATE TABLE TAPE_POOL(
LAST_UPDATE_TIME BIGINT UNSIGNED CONSTRAINT TAPE_POOL_LUT_NN NOT NULL,
CONSTRAINT TAPE_POOL_PK PRIMARY KEY(TAPE_POOL_ID),
CONSTRAINT TAPE_POOL_TPN_UN UNIQUE(TAPE_POOL_NAME),
CONSTRAINT TAPE_POOL_IS_ENCRYPTED_BOOL_CK CHECK(IS_ENCRYPTED IN ('0', '1'))
CONSTRAINT TAPE_POOL_IS_ENCRYPTED_BOOL_CK CHECK(IS_ENCRYPTED IN ('0', '1')),
CONSTRAINT TAPE_POOL_VO_FK FOREIGN KEY(VIRTUAL_ORGANIZATION_ID) REFERENCES VIRTUAL_ORGANIZATION(VIRTUAL_ORGANIZATION_ID)
);
CREATE TABLE ARCHIVE_ROUTE(
STORAGE_CLASS_ID BIGINT UNSIGNED CONSTRAINT ARCHIVE_ROUTE_SCI_NN NOT NULL,
......
......@@ -30,6 +30,14 @@ CREATE SEQUENCE TAPE_POOL_ID_SEQ
NOCYCLE
CACHE 20
NOORDER;
CREATE SEQUENCE VIRTUAL_ORGANIZATION_ID_SEQ
INCREMENT BY 1
START WITH 4294967296
NOMAXVALUE
MINVALUE 1
NOCYCLE
CACHE 20
NOORDER;
CREATE GLOBAL TEMPORARY TABLE TEMP_TAPE_FILE_INSERTION_BATCH(
VID VARCHAR2(100),
FSEQ NUMERIC(20, 0) ,
......@@ -75,11 +83,18 @@ CREATE TABLE DISK_SYSTEM(
LAST_UPDATE_TIME NUMERIC(20, 0) CONSTRAINT DISK_SYSTEM_LUT_NN NOT NULL,
CONSTRAINT NAME_PK PRIMARY KEY(DISK_SYSTEM_NAME)
);
CREATE TABLE VIRTUAL_ORGANIZATION(
VIRTUAL_ORGANIZATION_ID NUMERIC(20, 0) CONSTRAINT VIRTUAL_ORGANIZATION_VOI_NN NOT NULL,
VIRTUAL_ORGANIZATION_NAME VARCHAR2(100) CONSTRAINT VIRTUAL_ORGANIZATION_VON_NN NOT NULL,
CONSTRAINT VIRTUAL_ORGANIZATION_PK PRIMARY KEY(VIRTUAL_ORGANIZATION_ID),
CONSTRAINT VIRTUAL_ORGANIZATION_VON_UN UNIQUE(VIRTUAL_ORGANIZATION_NAME)
);
CREATE TABLE STORAGE_CLASS(
STORAGE_CLASS_ID NUMERIC(20, 0) CONSTRAINT STORAGE_CLASS_SCI_NN NOT NULL,
DISK_INSTANCE_NAME VARCHAR2(100) CONSTRAINT STORAGE_CLASS_DIN_NN NOT NULL,
STORAGE_CLASS_NAME VARCHAR2(100) CONSTRAINT STORAGE_CLASS_SCN_NN NOT NULL,
NB_COPIES NUMERIC(3, 0) CONSTRAINT STORAGE_CLASS_NC_NN NOT NULL,
VIRTUAL_ORGANIZATION_ID NUMERIC(20, 0),
USER_COMMENT VARCHAR2(1000) CONSTRAINT STORAGE_CLASS_UC_NN NOT NULL,
CREATION_LOG_USER_NAME VARCHAR2(100) CONSTRAINT STORAGE_CLASS_CLUN_NN NOT NULL,
CREATION_LOG_HOST_NAME VARCHAR2(100) CONSTRAINT STORAGE_CLASS_CLHN_NN NOT NULL,
......@@ -88,7 +103,8 @@ CREATE TABLE STORAGE_CLASS(
LAST_UPDATE_HOST_NAME VARCHAR2(100) CONSTRAINT STORAGE_CLASS_LUHN_NN NOT NULL,
LAST_UPDATE_TIME NUMERIC(20, 0) CONSTRAINT STORAGE_CLASS_LUT_NN NOT NULL,
CONSTRAINT STORAGE_CLASS_PK PRIMARY KEY(STORAGE_CLASS_ID),
CONSTRAINT STORAGE_CLASS_SCN_UN UNIQUE(STORAGE_CLASS_NAME)
CONSTRAINT STORAGE_CLASS_SCN_UN UNIQUE(STORAGE_CLASS_NAME),
CONSTRAINT STORAGE_CLASS_VOI_FK FOREIGN KEY(VIRTUAL_ORGANIZATION_ID) REFERENCES VIRTUAL_ORGANIZATION(VIRTUAL_ORGANIZATION_ID)
);
CREATE TABLE TAPE_POOL(
TAPE_POOL_ID NUMERIC(20, 0) CONSTRAINT TAPE_POOL_TPI_NN NOT NULL,
......@@ -97,6 +113,7 @@ CREATE TABLE TAPE_POOL(
NB_PARTIAL_TAPES NUMERIC(20, 0) CONSTRAINT TAPE_POOL_NPT_NN NOT NULL,
IS_ENCRYPTED CHAR(1) CONSTRAINT TAPE_POOL_IE_NN NOT NULL,
SUPPLY VARCHAR2(100),
VIRTUAL_ORGANIZATION_ID NUMERIC(20, 0),
USER_COMMENT VARCHAR2(1000) CONSTRAINT TAPE_POOL_UC_NN NOT NULL,
CREATION_LOG_USER_NAME VARCHAR2(100) CONSTRAINT TAPE_POOL_CLUN_NN NOT NULL,
CREATION_LOG_HOST_NAME VARCHAR2(100) CONSTRAINT TAPE_POOL_CLHN_NN NOT NULL,
......@@ -106,7 +123,8 @@ CREATE TABLE TAPE_POOL(
LAST_UPDATE_TIME NUMERIC(20, 0) CONSTRAINT TAPE_POOL_LUT_NN NOT NULL,
CONSTRAINT TAPE_POOL_PK PRIMARY KEY(TAPE_POOL_ID),
CONSTRAINT TAPE_POOL_TPN_UN UNIQUE(TAPE_POOL_NAME),
CONSTRAINT TAPE_POOL_IS_ENCRYPTED_BOOL_CK CHECK(IS_ENCRYPTED IN ('0', '1'))
CONSTRAINT TAPE_POOL_IS_ENCRYPTED_BOOL_CK CHECK(IS_ENCRYPTED IN ('0', '1')),
CONSTRAINT TAPE_POOL_VO_FK FOREIGN KEY(VIRTUAL_ORGANIZATION_ID) REFERENCES VIRTUAL_ORGANIZATION(VIRTUAL_ORGANIZATION_ID)
);
CREATE TABLE ARCHIVE_ROUTE(
STORAGE_CLASS_ID NUMERIC(20, 0) CONSTRAINT ARCHIVE_ROUTE_SCI_NN NOT NULL,
......
......@@ -26,6 +26,13 @@ CREATE SEQUENCE TAPE_POOL_ID_SEQ
MINVALUE 1
NO CYCLE
CACHE 20;
CREATE SEQUENCE VIRTUAL_ORGANIZATION_ID_SEQ
INCREMENT BY 1
START WITH 1
NO MAXVALUE
MINVALUE 1
NO CYCLE
CACHE 20;
CREATE TABLE CTA_CATALOGUE(
SCHEMA_VERSION_MAJOR NUMERIC(20, 0) CONSTRAINT CTA_CATALOGUE_SVM1_NN NOT NULL,
SCHEMA_VERSION_MINOR NUMERIC(20, 0) CONSTRAINT CTA_CATALOGUE_SVM2_NN NOT NULL,
......@@ -60,11 +67,18 @@ CREATE TABLE DISK_SYSTEM(
LAST_UPDATE_TIME NUMERIC(20, 0) CONSTRAINT DISK_SYSTEM_LUT_NN NOT NULL,
CONSTRAINT NAME_PK PRIMARY KEY(DISK_SYSTEM_NAME)
);
CREATE TABLE VIRTUAL_ORGANIZATION(
VIRTUAL_ORGANIZATION_ID NUMERIC(20, 0) CONSTRAINT VIRTUAL_ORGANIZATION_VOI_NN NOT NULL,
VIRTUAL_ORGANIZATION_NAME VARCHAR(100) CONSTRAINT VIRTUAL_ORGANIZATION_VON_NN NOT NULL,
CONSTRAINT VIRTUAL_ORGANIZATION_PK PRIMARY KEY(VIRTUAL_ORGANIZATION_ID),
CONSTRAINT VIRTUAL_ORGANIZATION_VON_UN UNIQUE(VIRTUAL_ORGANIZATION_NAME)
);
CREATE TABLE STORAGE_CLASS(
STORAGE_CLASS_ID NUMERIC(20, 0) CONSTRAINT STORAGE_CLASS_SCI_NN NOT NULL,
DISK_INSTANCE_NAME VARCHAR(100) CONSTRAINT STORAGE_CLASS_DIN_NN NOT NULL,
STORAGE_CLASS_NAME VARCHAR(100) CONSTRAINT STORAGE_CLASS_SCN_NN NOT NULL,
NB_COPIES NUMERIC(3, 0) CONSTRAINT STORAGE_CLASS_NC_NN NOT NULL,
VIRTUAL_ORGANIZATION_ID NUMERIC(20, 0),
USER_COMMENT VARCHAR(1000) CONSTRAINT STORAGE_CLASS_UC_NN NOT NULL,
CREATION_LOG_USER_NAME VARCHAR(100) CONSTRAINT STORAGE_CLASS_CLUN_NN NOT NULL,
CREATION_LOG_HOST_NAME VARCHAR(100) CONSTRAINT STORAGE_CLASS_CLHN_NN NOT NULL,
......@@ -73,7 +87,8 @@ CREATE TABLE STORAGE_CLASS(
LAST_UPDATE_HOST_NAME VARCHAR(100) CONSTRAINT STORAGE_CLASS_LUHN_NN NOT NULL,
LAST_UPDATE_TIME NUMERIC(20, 0) CONSTRAINT STORAGE_CLASS_LUT_NN NOT NULL,
CONSTRAINT STORAGE_CLASS_PK PRIMARY KEY(STORAGE_CLASS_ID),
CONSTRAINT STORAGE_CLASS_SCN_UN UNIQUE(STORAGE_CLASS_NAME)
CONSTRAINT STORAGE_CLASS_SCN_UN UNIQUE(STORAGE_CLASS_NAME),
CONSTRAINT STORAGE_CLASS_VOI_FK FOREIGN KEY(VIRTUAL_ORGANIZATION_ID) REFERENCES VIRTUAL_ORGANIZATION(VIRTUAL_ORGANIZATION_ID)
);
CREATE TABLE TAPE_POOL(
TAPE_POOL_ID NUMERIC(20, 0) CONSTRAINT TAPE_POOL_TPI_NN NOT NULL,
......@@ -82,6 +97,7 @@ CREATE TABLE TAPE_POOL(
NB_PARTIAL_TAPES NUMERIC(20, 0) CONSTRAINT TAPE_POOL_NPT_NN NOT NULL,
IS_ENCRYPTED CHAR(1) CONSTRAINT TAPE_POOL_IE_NN NOT NULL,
SUPPLY VARCHAR(100),
VIRTUAL_ORGANIZATION_ID NUMERIC(20, 0),
USER_COMMENT VARCHAR(1000) CONSTRAINT TAPE_POOL_UC_NN NOT NULL,
CREATION_LOG_USER_NAME VARCHAR(100) CONSTRAINT TAPE_POOL_CLUN_NN NOT NULL,
CREATION_LOG_HOST_NAME VARCHAR(100) CONSTRAINT TAPE_POOL_CLHN_NN NOT NULL,
......@@ -91,7 +107,8 @@ CREATE TABLE TAPE_POOL(
LAST_UPDATE_TIME NUMERIC(20, 0) CONSTRAINT TAPE_POOL_LUT_NN NOT NULL,
CONSTRAINT TAPE_POOL_PK PRIMARY KEY(TAPE_POOL_ID),
CONSTRAINT TAPE_POOL_TPN_UN UNIQUE(TAPE_POOL_NAME),
CONSTRAINT TAPE_POOL_IS_ENCRYPTED_BOOL_CK CHECK(IS_ENCRYPTED IN ('0', '1'))
CONSTRAINT TAPE_POOL_IS_ENCRYPTED_BOOL_CK CHECK(IS_ENCRYPTED IN ('0', '1')),
CONSTRAINT TAPE_POOL_VO_FK FOREIGN KEY(VIRTUAL_ORGANIZATION_ID) REFERENCES VIRTUAL_ORGANIZATION(VIRTUAL_ORGANIZATION_ID)
);
CREATE TABLE ARCHIVE_ROUTE(
STORAGE_CLASS_ID NUMERIC(20, 0) CONSTRAINT ARCHIVE_ROUTE_SCI_NN NOT NULL,
......
......@@ -10,6 +10,9 @@ CREATE TABLE STORAGE_CLASS_ID(
CREATE TABLE TAPE_POOL_ID(
ID INTEGER PRIMARY KEY AUTOINCREMENT
);
CREATE TABLE VIRTUAL_ORGANIZATION_ID(
ID INTEGER PRIMARY KEY AUTOINCREMENT
);
CREATE TABLE CTA_CATALOGUE(
SCHEMA_VERSION_MAJOR INTEGER CONSTRAINT CTA_CATALOGUE_SVM1_NN NOT NULL,
SCHEMA_VERSION_MINOR INTEGER CONSTRAINT CTA_CATALOGUE_SVM2_NN NOT NULL,
......@@ -44,11 +47,18 @@ CREATE TABLE DISK_SYSTEM(
LAST_UPDATE_TIME INTEGER CONSTRAINT DISK_SYSTEM_LUT_NN NOT NULL,
CONSTRAINT NAME_PK PRIMARY KEY(DISK_SYSTEM_NAME)
);
CREATE TABLE VIRTUAL_ORGANIZATION(
VIRTUAL_ORGANIZATION_ID INTEGER CONSTRAINT VIRTUAL_ORGANIZATION_VOI_NN NOT NULL,
VIRTUAL_ORGANIZATION_NAME VARCHAR(100) CONSTRAINT VIRTUAL_ORGANIZATION_VON_NN NOT NULL,
CONSTRAINT VIRTUAL_ORGANIZATION_PK PRIMARY KEY(VIRTUAL_ORGANIZATION_ID),
CONSTRAINT VIRTUAL_ORGANIZATION_VON_UN UNIQUE(VIRTUAL_ORGANIZATION_NAME)
);
CREATE TABLE STORAGE_CLASS(
STORAGE_CLASS_ID INTEGER CONSTRAINT STORAGE_CLASS_SCI_NN NOT NULL,
DISK_INSTANCE_NAME VARCHAR(100) CONSTRAINT STORAGE_CLASS_DIN_NN NOT NULL,
STORAGE_CLASS_NAME VARCHAR(100) CONSTRAINT STORAGE_CLASS_SCN_NN NOT NULL,
NB_COPIES INTEGER CONSTRAINT STORAGE_CLASS_NC_NN NOT NULL,
VIRTUAL_ORGANIZATION_ID INTEGER,
USER_COMMENT VARCHAR(1000) CONSTRAINT STORAGE_CLASS_UC_NN NOT NULL,
CREATION_LOG_USER_NAME VARCHAR(100) CONSTRAINT STORAGE_CLASS_CLUN_NN NOT NULL,
CREATION_LOG_HOST_NAME VARCHAR(100) CONSTRAINT STORAGE_CLASS_CLHN_NN NOT NULL,
......@@ -57,7 +67,8 @@ CREATE TABLE STORAGE_CLASS(
LAST_UPDATE_HOST_NAME VARCHAR(100) CONSTRAINT STORAGE_CLASS_LUHN_NN NOT NULL,
LAST_UPDATE_TIME INTEGER CONSTRAINT STORAGE_CLASS_LUT_NN NOT NULL,
CONSTRAINT STORAGE_CLASS_PK PRIMARY KEY(STORAGE_CLASS_ID),
CONSTRAINT STORAGE_CLASS_SCN_UN UNIQUE(STORAGE_CLASS_NAME)
CONSTRAINT STORAGE_CLASS_SCN_UN UNIQUE(STORAGE_CLASS_NAME),
CONSTRAINT STORAGE_CLASS_VOI_FK FOREIGN KEY(VIRTUAL_ORGANIZATION_ID) REFERENCES VIRTUAL_ORGANIZATION(VIRTUAL_ORGANIZATION_ID)
);
CREATE TABLE TAPE_POOL(
TAPE_POOL_ID INTEGER CONSTRAINT TAPE_POOL_TPI_NN NOT NULL,
......@@ -66,6 +77,7 @@ CREATE TABLE TAPE_POOL(
NB_PARTIAL_TAPES INTEGER CONSTRAINT TAPE_POOL_NPT_NN NOT NULL,
IS_ENCRYPTED CHAR(1) CONSTRAINT TAPE_POOL_IE_NN NOT NULL,
SUPPLY VARCHAR(100),
VIRTUAL_ORGANIZATION_ID INTEGER,
USER_COMMENT VARCHAR(1000) CONSTRAINT TAPE_POOL_UC_NN NOT NULL,
CREATION_LOG_USER_NAME VARCHAR(100) CONSTRAINT TAPE_POOL_CLUN_NN NOT NULL,
CREATION_LOG_HOST_NAME VARCHAR(100) CONSTRAINT TAPE_POOL_CLHN_NN NOT NULL,
......@@ -75,7 +87,8 @@ CREATE TABLE TAPE_POOL(
LAST_UPDATE_TIME INTEGER CONSTRAINT TAPE_POOL_LUT_NN NOT NULL,
CONSTRAINT TAPE_POOL_PK PRIMARY KEY(TAPE_POOL_ID),
CONSTRAINT TAPE_POOL_TPN_UN UNIQUE(TAPE_POOL_NAME),
CONSTRAINT TAPE_POOL_IS_ENCRYPTED_BOOL_CK CHECK(IS_ENCRYPTED IN ('0', '1'))
CONSTRAINT TAPE_POOL_IS_ENCRYPTED_BOOL_CK CHECK(IS_ENCRYPTED IN ('0', '1')),
CONSTRAINT TAPE_POOL_VO_FK FOREIGN KEY(VIRTUAL_ORGANIZATION_ID) REFERENCES VIRTUAL_ORGANIZATION(VIRTUAL_ORGANIZATION_ID)
);
CREATE TABLE ARCHIVE_ROUTE(
STORAGE_CLASS_ID INTEGER CONSTRAINT ARCHIVE_ROUTE_SCI_NN NOT NULL,
......
......@@ -2498,6 +2498,14 @@ namespace catalogue{
" NOCYCLE"
" CACHE 20"
" NOORDER;"
"CREATE SEQUENCE VIRTUAL_ORGANIZATION_ID_SEQ"
" INCREMENT BY 1"
" START WITH 4294967296"
" NOMAXVALUE"
" MINVALUE 1"
" NOCYCLE"
" CACHE 20"
" NOORDER;"
"CREATE GLOBAL TEMPORARY TABLE TEMP_TAPE_FILE_INSERTION_BATCH("
" VID VARCHAR2(100),"
" FSEQ NUMERIC(20, 0) ,"
......@@ -2543,11 +2551,18 @@ namespace catalogue{
" LAST_UPDATE_TIME NUMERIC(20, 0) CONSTRAINT DISK_SYSTEM_LUT_NN NOT NULL,"
" CONSTRAINT NAME_PK PRIMARY KEY(DISK_SYSTEM_NAME)"
");"
"CREATE TABLE VIRTUAL_ORGANIZATION("
" VIRTUAL_ORGANIZATION_ID NUMERIC(20, 0) CONSTRAINT VIRTUAL_ORGANIZATION_VOI_NN NOT NULL,"
" VIRTUAL_ORGANIZATION_NAME VARCHAR2(100) CONSTRAINT VIRTUAL_ORGANIZATION_VON_NN NOT NULL,"
" CONSTRAINT VIRTUAL_ORGANIZATION_PK PRIMARY KEY(VIRTUAL_ORGANIZATION_ID),"
" CONSTRAINT VIRTUAL_ORGANIZATION_VON_UN UNIQUE(VIRTUAL_ORGANIZATION_NAME)"
");"
"CREATE TABLE STORAGE_CLASS("
" STORAGE_CLASS_ID NUMERIC(20, 0) CONSTRAINT STORAGE_CLASS_SCI_NN NOT NULL,"
" DISK_INSTANCE_NAME VARCHAR2(100) CONSTRAINT STORAGE_CLASS_DIN_NN NOT NULL,"
" STORAGE_CLASS_NAME VARCHAR2(100) CONSTRAINT STORAGE_CLASS_SCN_NN NOT NULL,"
" NB_COPIES NUMERIC(3, 0) CONSTRAINT STORAGE_CLASS_NC_NN NOT NULL,"
" VIRTUAL_ORGANIZATION_ID NUMERIC(20, 0), "
" USER_COMMENT VARCHAR2(1000) CONSTRAINT STORAGE_CLASS_UC_NN NOT NULL,"
" CREATION_LOG_USER_NAME VARCHAR2(100) CONSTRAINT STORAGE_CLASS_CLUN_NN NOT NULL,"
" CREATION_LOG_HOST_NAME VARCHAR2(100) CONSTRAINT STORAGE_CLASS_CLHN_NN NOT NULL,"
......@@ -2556,7 +2571,8 @@ namespace catalogue{
" LAST_UPDATE_HOST_NAME VARCHAR2(100) CONSTRAINT STORAGE_CLASS_LUHN_NN NOT NULL,"
" LAST_UPDATE_TIME NUMERIC(20, 0) CONSTRAINT STORAGE_CLASS_LUT_NN NOT NULL,"
" CONSTRAINT STORAGE_CLASS_PK PRIMARY KEY(STORAGE_CLASS_ID),"
" CONSTRAINT STORAGE_CLASS_SCN_UN UNIQUE(STORAGE_CLASS_NAME)"
" CONSTRAINT STORAGE_CLASS_SCN_UN UNIQUE(STORAGE_CLASS_NAME),"
" CONSTRAINT STORAGE_CLASS_VOI_FK FOREIGN KEY(VIRTUAL_ORGANIZATION_ID) REFERENCES VIRTUAL_ORGANIZATION(VIRTUAL_ORGANIZATION_ID)"
");"
"CREATE TABLE TAPE_POOL("
" TAPE_POOL_ID NUMERIC(20, 0) CONSTRAINT TAPE_POOL_TPI_NN NOT NULL,"
......@@ -2565,6 +2581,7 @@ namespace catalogue{
" NB_PARTIAL_TAPES NUMERIC(20, 0) CONSTRAINT TAPE_POOL_NPT_NN NOT NULL,"
" IS_ENCRYPTED CHAR(1) CONSTRAINT TAPE_POOL_IE_NN NOT NULL,"
" SUPPLY VARCHAR2(100),"
" VIRTUAL_ORGANIZATION_ID NUMERIC(20, 0),"
" USER_COMMENT VARCHAR2(1000) CONSTRAINT TAPE_POOL_UC_NN NOT NULL,"
" CREATION_LOG_USER_NAME VARCHAR2(100) CONSTRAINT TAPE_POOL_CLUN_NN NOT NULL,"
" CREATION_LOG_HOST_NAME VARCHAR2(100) CONSTRAINT TAPE_POOL_CLHN_NN NOT NULL,"
......@@ -2574,7 +2591,8 @@ namespace catalogue{
" LAST_UPDATE_TIME NUMERIC(20, 0) CONSTRAINT TAPE_POOL_LUT_NN NOT NULL,"
" CONSTRAINT TAPE_POOL_PK PRIMARY KEY(TAPE_POOL_ID),"
" CONSTRAINT TAPE_POOL_TPN_UN UNIQUE(TAPE_POOL_NAME),"
" CONSTRAINT TAPE_POOL_IS_ENCRYPTED_BOOL_CK CHECK(IS_ENCRYPTED IN ('0', '1'))"
" CONSTRAINT TAPE_POOL_IS_ENCRYPTED_BOOL_CK CHECK(IS_ENCRYPTED IN ('0', '1')),"
" CONSTRAINT TAPE_POOL_VO_FK FOREIGN KEY(VIRTUAL_ORGANIZATION_ID) REFERENCES VIRTUAL_ORGANIZATION(VIRTUAL_ORGANIZATION_ID)"
");"
"CREATE TABLE ARCHIVE_ROUTE("
" STORAGE_CLASS_ID NUMERIC(20, 0) CONSTRAINT ARCHIVE_ROUTE_SCI_NN NOT NULL,"
......@@ -2813,7 +2831,11 @@ namespace catalogue{
" CONSTRAINT TAPE_POOL_ID_PK PRIMARY KEY(ID)"
");"
"INSERT INTO TAPE_POOL_ID(ID) VALUES(1);"
""
"CREATE TABLE VIRTUAL_ORGANIZATION_ID("
" ID BIGINT UNSIGNED,"
" CONSTRAINT VIRTUAL_ORGANIZATION_ID_PK PRIMARY KEY(ID)"
");"
"INSERT INTO VIRTUAL_ORGANIZATION_ID(ID) VALUES(1);"
"CREATE TABLE CTA_CATALOGUE("
" SCHEMA_VERSION_MAJOR BIGINT UNSIGNED CONSTRAINT CTA_CATALOGUE_SVM1_NN NOT NULL,"
" SCHEMA_VERSION_MINOR BIGINT UNSIGNED CONSTRAINT CTA_CATALOGUE_SVM2_NN NOT NULL,"
......@@ -2848,11 +2870,18 @@ namespace catalogue{
" LAST_UPDATE_TIME BIGINT UNSIGNED CONSTRAINT DISK_SYSTEM_LUT_NN NOT NULL,"
" CONSTRAINT NAME_PK PRIMARY KEY(DISK_SYSTEM_NAME)"
");"
"CREATE TABLE VIRTUAL_ORGANIZATION("
" VIRTUAL_ORGANIZATION_ID BIGINT UNSIGNED CONSTRAINT VIRTUAL_ORGANIZATION_VOI_NN NOT NULL,"
" VIRTUAL_ORGANIZATION_NAME VARCHAR(100) CONSTRAINT VIRTUAL_ORGANIZATION_VON_NN NOT NULL,"
" CONSTRAINT VIRTUAL_ORGANIZATION_PK PRIMARY KEY(VIRTUAL_ORGANIZATION_ID),"
" CONSTRAINT VIRTUAL_ORGANIZATION_VON_UN UNIQUE(VIRTUAL_ORGANIZATION_NAME)"
");"
"CREATE TABLE STORAGE_CLASS("
" STORAGE_CLASS_ID BIGINT UNSIGNED CONSTRAINT STORAGE_CLASS_SCI_NN NOT NULL,"
" DISK_INSTANCE_NAME VARCHAR(100) CONSTRAINT STORAGE_CLASS_DIN_NN NOT NULL,"
" STORAGE_CLASS_NAME VARCHAR(100) CONSTRAINT STORAGE_CLASS_SCN_NN NOT NULL,"
" NB_COPIES TINYINT UNSIGNED CONSTRAINT STORAGE_CLASS_NC_NN NOT NULL,"
" VIRTUAL_ORGANIZATION_ID BIGINT UNSIGNED, "
" USER_COMMENT VARCHAR(1000) CONSTRAINT STORAGE_CLASS_UC_NN NOT NULL,"
" CREATION_LOG_USER_NAME VARCHAR(100) CONSTRAINT STORAGE_CLASS_CLUN_NN NOT NULL,"
" CREATION_LOG_HOST_NAME VARCHAR(100) CONSTRAINT STORAGE_CLASS_CLHN_NN NOT NULL,"
......@@ -2861,7 +2890,8 @@ namespace catalogue{
" LAST_UPDATE_HOST_NAME VARCHAR(100) CONSTRAINT STORAGE_CLASS_LUHN_NN NOT NULL,"
" LAST_UPDATE_TIME BIGINT UNSIGNED CONSTRAINT STORAGE_CLASS_LUT_NN NOT NULL,"
" CONSTRAINT STORAGE_CLASS_PK PRIMARY KEY(STORAGE_CLASS_ID),"
" CONSTRAINT STORAGE_CLASS_SCN_UN UNIQUE(STORAGE_CLASS_NAME)"
" CONSTRAINT STORAGE_CLASS_SCN_UN UNIQUE(STORAGE_CLASS_NAME),"
" CONSTRAINT STORAGE_CLASS_VOI_FK FOREIGN KEY(VIRTUAL_ORGANIZATION_ID) REFERENCES VIRTUAL_ORGANIZATION(VIRTUAL_ORGANIZATION_ID)"
");"
"CREATE TABLE TAPE_POOL("
" TAPE_POOL_ID BIGINT UNSIGNED CONSTRAINT TAPE_POOL_TPI_NN NOT NULL,"
......@@ -2870,6 +2900,7 @@ namespace catalogue{
" NB_PARTIAL_TAPES BIGINT UNSIGNED CONSTRAINT TAPE_POOL_NPT_NN NOT NULL,"
" IS_ENCRYPTED CHAR(1) CONSTRAINT TAPE_POOL_IE_NN NOT NULL,"
" SUPPLY VARCHAR(100),"
" VIRTUAL_ORGANIZATION_ID BIGINT UNSIGNED,"
" USER_COMMENT VARCHAR(1000) CONSTRAINT TAPE_POOL_UC_NN NOT NULL,"
" CREATION_LOG_USER_NAME VARCHAR(100) CONSTRAINT TAPE_POOL_CLUN_NN NOT NULL,"
" CREATION_LOG_HOST_NAME VARCHAR(100) CONSTRAINT TAPE_POOL_CLHN_NN NOT NULL,"
......@@ -2879,7 +2910,8 @@ namespace catalogue{
" LAST_UPDATE_TIME BIGINT UNSIGNED CONSTRAINT TAPE_POOL_LUT_NN NOT NULL,"
" CONSTRAINT TAPE_POOL_PK PRIMARY KEY(TAPE_POOL_ID),"
" CONSTRAINT TAPE_POOL_TPN_UN UNIQUE(TAPE_POOL_NAME),"
" CONSTRAINT TAPE_POOL_IS_ENCRYPTED_BOOL_CK CHECK(IS_ENCRYPTED IN ('0', '1'))"
" CONSTRAINT TAPE_POOL_IS_ENCRYPTED_BOOL_CK CHECK(IS_ENCRYPTED IN ('0', '1')),"
" CONSTRAINT TAPE_POOL_VO_FK FOREIGN KEY(VIRTUAL_ORGANIZATION_ID) REFERENCES VIRTUAL_ORGANIZATION(VIRTUAL_ORGANIZATION_ID)"
");"
"CREATE TABLE ARCHIVE_ROUTE("
" STORAGE_CLASS_ID BIGINT UNSIGNED CONSTRAINT ARCHIVE_ROUTE_SCI_NN NOT NULL,"
......@@ -3109,6 +3141,9 @@ namespace catalogue{
"CREATE TABLE TAPE_POOL_ID("
" ID INTEGER PRIMARY KEY AUTOINCREMENT"
");"
"CREATE TABLE VIRTUAL_ORGANIZATION_ID("
" ID INTEGER PRIMARY KEY AUTOINCREMENT"
");"
"CREATE TABLE CTA_CATALOGUE("
" SCHEMA_VERSION_MAJOR INTEGER CONSTRAINT CTA_CATALOGUE_SVM1_NN NOT NULL,"
" SCHEMA_VERSION_MINOR INTEGER CONSTRAINT CTA_CATALOGUE_SVM2_NN NOT NULL,"
......@@ -3143,11 +3178,18 @@ namespace catalogue{
" LAST_UPDATE_TIME INTEGER CONSTRAINT DISK_SYSTEM_LUT_NN NOT NULL,"
" CONSTRAINT NAME_PK PRIMARY KEY(DISK_SYSTEM_NAME)"
");"
"CREATE TABLE VIRTUAL_ORGANIZATION("
" VIRTUAL_ORGANIZATION_ID INTEGER CONSTRAINT VIRTUAL_ORGANIZATION_VOI_NN NOT NULL,"
" VIRTUAL_ORGANIZATION_NAME VARCHAR(100) CONSTRAINT VIRTUAL_ORGANIZATION_VON_NN NOT NULL,"
" CONSTRAINT VIRTUAL_ORGANIZATION_PK PRIMARY KEY(VIRTUAL_ORGANIZATION_ID),"
" CONSTRAINT VIRTUAL_ORGANIZATION_VON_UN UNIQUE(VIRTUAL_ORGANIZATION_NAME)"
");"
"CREATE TABLE STORAGE_CLASS("
" STORAGE_CLASS_ID INTEGER CONSTRAINT STORAGE_CLASS_SCI_NN NOT NULL,"
" DISK_INSTANCE_NAME VARCHAR(100) CONSTRAINT STORAGE_CLASS_DIN_NN NOT NULL,"
" STORAGE_CLASS_NAME VARCHAR(100) CONSTRAINT STORAGE_CLASS_SCN_NN NOT NULL,"
" NB_COPIES INTEGER CONSTRAINT STORAGE_CLASS_NC_NN NOT NULL,"
" VIRTUAL_ORGANIZATION_ID INTEGER, "
" USER_COMMENT VARCHAR(1000) CONSTRAINT STORAGE_CLASS_UC_NN NOT NULL,"
" CREATION_LOG_USER_NAME VARCHAR(100) CONSTRAINT STORAGE_CLASS_CLUN_NN NOT NULL,"
" CREATION_LOG_HOST_NAME VARCHAR(100) CONSTRAINT STORAGE_CLASS_CLHN_NN NOT NULL,"
......@@ -3156,7 +3198,8 @@ namespace catalogue{
" LAST_UPDATE_HOST_NAME VARCHAR(100) CONSTRAINT STORAGE_CLASS_LUHN_NN NOT NULL,"
" LAST_UPDATE_TIME INTEGER CONSTRAINT STORAGE_CLASS_LUT_NN NOT NULL,"
" CONSTRAINT STORAGE_CLASS_PK PRIMARY KEY(STORAGE_CLASS_ID),"
" CONSTRAINT STORAGE_CLASS_SCN_UN UNIQUE(STORAGE_CLASS_NAME)"
" CONSTRAINT STORAGE_CLASS_SCN_UN UNIQUE(STORAGE_CLASS_NAME),"
" CONSTRAINT STORAGE_CLASS_VOI_FK FOREIGN KEY(VIRTUAL_ORGANIZATION_ID) REFERENCES VIRTUAL_ORGANIZATION(VIRTUAL_ORGANIZATION_ID)"
");"
"CREATE TABLE TAPE_POOL("
" TAPE_POOL_ID INTEGER CONSTRAINT TAPE_POOL_TPI_NN NOT NULL,"
......@@ -3165,6 +3208,7 @@ namespace catalogue{
" NB_PARTIAL_TAPES INTEGER CONSTRAINT TAPE_POOL_NPT_NN NOT NULL,"
" IS_ENCRYPTED CHAR(1) CONSTRAINT TAPE_POOL_IE_NN NOT NULL,"
" SUPPLY VARCHAR(100),"
" VIRTUAL_ORGANIZATION_ID INTEGER,"
" USER_COMMENT VARCHAR(1000) CONSTRAINT TAPE_POOL_UC_NN NOT NULL,"
" CREATION_LOG_USER_NAME VARCHAR(100) CONSTRAINT TAPE_POOL_CLUN_NN NOT NULL,"
" CREATION_LOG_HOST_NAME VARCHAR(100) CONSTRAINT TAPE_POOL_CLHN_NN NOT NULL,"
......@@ -3174,7 +3218,8 @@ namespace catalogue{
" LAST_UPDATE_TIME INTEGER CONSTRAINT TAPE_POOL_LUT_NN NOT NULL,"
" CONSTRAINT TAPE_POOL_PK PRIMARY KEY(TAPE_POOL_ID),"
" CONSTRAINT TAPE_POOL_TPN_UN UNIQUE(TAPE_POOL_NAME),"
" CONSTRAINT TAPE_POOL_IS_ENCRYPTED_BOOL_CK CHECK(IS_ENCRYPTED IN ('0', '1'))"
" CONSTRAINT TAPE_POOL_IS_ENCRYPTED_BOOL_CK CHECK(IS_ENCRYPTED IN ('0', '1')),"
" CONSTRAINT TAPE_POOL_VO_FK FOREIGN KEY(VIRTUAL_ORGANIZATION_ID) REFERENCES VIRTUAL_ORGANIZATION(VIRTUAL_ORGANIZATION_ID)"
");"
"CREATE TABLE ARCHIVE_ROUTE("
" STORAGE_CLASS_ID INTEGER CONSTRAINT ARCHIVE_ROUTE_SCI_NN NOT NULL,"
......@@ -3418,6 +3463,13 @@ namespace catalogue{
" MINVALUE 1"
" NO CYCLE"
" CACHE 20;"
"CREATE SEQUENCE VIRTUAL_ORGANIZATION_ID_SEQ"
" INCREMENT BY 1"
" START WITH 1"
" NO MAXVALUE"
" MINVALUE 1"
" NO CYCLE"
" CACHE 20;"
"CREATE TABLE CTA_CATALOGUE("
" SCHEMA_VERSION_MAJOR NUMERIC(20, 0) CONSTRAINT CTA_CATALOGUE_SVM1_NN NOT NULL,"
" SCHEMA_VERSION_MINOR NUMERIC(20, 0) CONSTRAINT CTA_CATALOGUE_SVM2_NN NOT NULL,"
......@@ -3452,11 +3504,18 @@ namespace catalogue{
" LAST_UPDATE_TIME NUMERIC(20, 0) CONSTRAINT DISK_SYSTEM_LUT_NN NOT NULL,"
" CONSTRAINT NAME_PK PRIMARY KEY(DISK_SYSTEM_NAME)"
");"
"CREATE TABLE VIRTUAL_ORGANIZATION("
" VIRTUAL_ORGANIZATION_ID NUMERIC(20, 0) CONSTRAINT VIRTUAL_ORGANIZATION_VOI_NN NOT NULL,"
" VIRTUAL_ORGANIZATION_NAME VARCHAR(100) CONSTRAINT VIRTUAL_ORGANIZATION_VON_NN NOT NULL,"
" CONSTRAINT VIRTUAL_ORGANIZATION_PK PRIMARY KEY(VIRTUAL_ORGANIZATION_ID),"
" CONSTRAINT VIRTUAL_ORGANIZATION_VON_UN UNIQUE(VIRTUAL_ORGANIZATION_NAME)"
");"
"CREATE TABLE STORAGE_CLASS("
" STORAGE_CLASS_ID NUMERIC(20, 0) CONSTRAINT STORAGE_CLASS_SCI_NN NOT NULL,"
" DISK_INSTANCE_NAME VARCHAR(100) CONSTRAINT STORAGE_CLASS_DIN_NN NOT NULL,"
" STORAGE_CLASS_NAME VARCHAR(100) CONSTRAINT STORAGE_CLASS_SCN_NN NOT NULL,"
" NB_COPIES NUMERIC(3, 0) CONSTRAINT STORAGE_CLASS_NC_NN NOT NULL,"
" VIRTUAL_ORGANIZATION_ID NUMERIC(20, 0), "
" USER_COMMENT VARCHAR(1000) CONSTRAINT STORAGE_CLASS_UC_NN NOT NULL,"
" CREATION_LOG_USER_NAME VARCHAR(100) CONSTRAINT STORAGE_CLASS_CLUN_NN NOT NULL,"
" CREATION_LOG_HOST_NAME VARCHAR(100) CONSTRAINT STORAGE_CLASS_CLHN_NN NOT NULL,"
......@@ -3465,7 +3524,8 @@ namespace catalogue{
" LAST_UPDATE_HOST_NAME VARCHAR(100) CONSTRAINT STORAGE_CLASS_LUHN_NN NOT NULL,"
" LAST_UPDATE_TIME NUMERIC(20, 0) CONSTRAINT STORAGE_CLASS_LUT_NN NOT NULL,"
" CONSTRAINT STORAGE_CLASS_PK PRIMARY KEY(STORAGE_CLASS_ID),"
" CONSTRAINT STORAGE_CLASS_SCN_UN UNIQUE(STORAGE_CLASS_NAME)"
" CONSTRAINT STORAGE_CLASS_SCN_UN UNIQUE(STORAGE_CLASS_NAME),"
" CONSTRAINT STORAGE_CLASS_VOI_FK FOREIGN KEY(VIRTUAL_ORGANIZATION_ID) REFERENCES VIRTUAL_ORGANIZATION(VIRTUAL_ORGANIZATION_ID)"
");"
"CREATE TABLE TAPE_POOL("
" TAPE_POOL_ID NUMERIC(20, 0) CONSTRAINT TAPE_POOL_TPI_NN NOT NULL,"
......@@ -3474,6 +3534,7 @@ namespace catalogue{
" NB_PARTIAL_TAPES NUMERIC(20, 0) CONSTRAINT TAPE_POOL_NPT_NN NOT NULL,"
" IS_ENCRYPTED CHAR(1) CONSTRAINT TAPE_POOL_IE_NN NOT NULL,"
" SUPPLY VARCHAR(100),"
" VIRTUAL_ORGANIZATION_ID NUMERIC(20, 0),"
" USER_COMMENT VARCHAR(1000) CONSTRAINT TAPE_POOL_UC_NN NOT NULL,"
" CREATION_LOG_USER_NAME VARCHAR(100) CONSTRAINT TAPE_POOL_CLUN_NN NOT NULL,"
" CREATION_LOG_HOST_NAME VARCHAR(100) CONSTRAINT TAPE_POOL_CLHN_NN NOT NULL,"
......@@ -3483,7 +3544,8 @@ namespace catalogue{
" LAST_UPDATE_TIME NUMERIC(20, 0) CONSTRAINT TAPE_POOL_LUT_NN NOT NULL,"
" CONSTRAINT TAPE_POOL_PK PRIMARY KEY(TAPE_POOL_ID),"
" CONSTRAINT TAPE_POOL_TPN_UN UNIQUE(TAPE_POOL_NAME),"
" CONSTRAINT TAPE_POOL_IS_ENCRYPTED_BOOL_CK CHECK(IS_ENCRYPTED IN ('0', '1'))"
" CONSTRAINT TAPE_POOL_IS_ENCRYPTED_BOOL_CK CHECK(IS_ENCRYPTED IN ('0', '1')),"
" CONSTRAINT TAPE_POOL_VO_FK FOREIGN KEY(VIRTUAL_ORGANIZATION_ID) REFERENCES VIRTUAL_ORGANIZATION(VIRTUAL_ORGANIZATION_ID)"
");"
"CREATE TABLE ARCHIVE_ROUTE("
" STORAGE_CLASS_ID NUMERIC(20, 0) CONSTRAINT ARCHIVE_ROUTE_SCI_NN NOT NULL,"
......
......@@ -149,6 +149,8 @@ void DropSchemaCmd::dropSqliteCatalogueSchema(rdbms::Conn &conn) {
"STORAGE_CLASS_ID",
"TAPE_POOL",
"TAPE_POOL_ID",
"VIRTUAL_ORGANIZATION",
"VIRTUAL_ORGANIZATION_ID",
"LOGICAL_LIBRARY",
"LOGICAL_LIBRARY_ID",
"MOUNT_POLICY",
......@@ -186,6 +188,8 @@ void DropSchemaCmd::dropMysqlCatalogueSchema(rdbms::Conn &conn) {
"STORAGE_CLASS_ID",
"TAPE_POOL",
"TAPE_POOL_ID",
"VIRTUAL_ORGANIZATION",
"VIRTUAL_ORGANIZATION_ID",
"LOGICAL_LIBRARY",
"LOGICAL_LIBRARY_ID",
"MOUNT_POLICY",
......@@ -262,6 +266,7 @@ void DropSchemaCmd::dropOracleCatalogueSchema(rdbms::Conn &conn) {
"ADMIN_HOST",
"STORAGE_CLASS",
"TAPE_POOL",
"VIRTUAL_ORGANIZATION",
"LOGICAL_LIBRARY",
"MOUNT_POLICY",
"ACTIVITIES_WEIGHTS",
......@@ -276,7 +281,8 @@ void DropSchemaCmd::dropOracleCatalogueSchema(rdbms::Conn &conn) {
"ARCHIVE_FILE_ID_SEQ",
"LOGICAL_LIBRARY_ID_SEQ",
"STORAGE_CLASS_ID_SEQ",
"TAPE_POOL_ID_SEQ"
"TAPE_POOL_ID_SEQ",
"VIRTUAL_ORGANIZATION_ID_SEQ"
};
dropDatabaseSequences(conn, sequencesToDrop);
} catch(exception::Exception &ex) {
......@@ -305,6 +311,7 @@ void DropSchemaCmd::dropPostgresCatalogueSchema(rdbms::Conn &conn) {
"ADMIN_HOST",
"STORAGE_CLASS",
"TAPE_POOL",
"VIRTUAL_ORGANIZATION",
"LOGICAL_LIBRARY",
"MOUNT_POLICY",
"ACTIVITIES_WEIGHTS",
......@@ -319,7 +326,9 @@ void DropSchemaCmd::dropPostgresCatalogueSchema(rdbms::Conn &conn) {
"ARCHIVE_FILE_ID_SEQ",
"LOGICAL_LIBRARY_ID_SEQ",
"STORAGE_CLASS_ID_SEQ",
"TAPE_POOL_ID_SEQ"};
"TAPE_POOL_ID_SEQ",
"VIRTUAL_ORGANIZATION_ID_SEQ"
};
dropDatabaseSequences(conn, sequencesToDrop);
} catch(exception::Exception &ex) {
throw exception::Exception(std::string(__FUNCTION__) + " failed: " + ex.getMessage().str());
......
......@@ -32,11 +32,18 @@ CREATE TABLE DISK_SYSTEM(
LAST_UPDATE_TIME UINT64TYPE CONSTRAINT DISK_SYSTEM_LUT_NN NOT NULL,
CONSTRAINT NAME_PK PRIMARY KEY(DISK_SYSTEM_NAME)
);
CREATE TABLE VIRTUAL_ORGANIZATION(
VIRTUAL_ORGANIZATION_ID UINT64TYPE CONSTRAINT VIRTUAL_ORGANIZATION_VOI_NN NOT NULL,
VIRTUAL_ORGANIZATION_NAME VARCHAR(100) CONSTRAINT VIRTUAL_ORGANIZATION_VON_NN NOT NULL,
CONSTRAINT VIRTUAL_ORGANIZATION_PK PRIMARY KEY(VIRTUAL_ORGANIZATION_ID),
CONSTRAINT VIRTUAL_ORGANIZATION_VON_UN UNIQUE(VIRTUAL_ORGANIZATION_NAME)
);
CREATE TABLE STORAGE_CLASS(
STORAGE_CLASS_ID UINT64TYPE CONSTRAINT STORAGE_CLASS_SCI_NN NOT NULL,
DISK_INSTANCE_NAME VARCHAR(100) CONSTRAINT STORAGE_CLASS_DIN_NN NOT NULL,
STORAGE_CLASS_NAME VARCHAR(100) CONSTRAINT STORAGE_CLASS_SCN_NN NOT NULL,
NB_COPIES UINT8TYPE CONSTRAINT STORAGE_CLASS_NC_NN NOT NULL,
VIRTUAL_ORGANIZATION_ID UINT64TYPE,
USER_COMMENT VARCHAR(1000) CONSTRAINT STORAGE_CLASS_UC_NN NOT NULL,
CREATION_LOG_USER_NAME VARCHAR(100) CONSTRAINT STORAGE_CLASS_CLUN_NN NOT NULL,
CREATION_LOG_HOST_NAME VARCHAR(100) CONSTRAINT STORAGE_CLASS_CLHN_NN NOT NULL,
......@@ -45,7 +52,8 @@ CREATE TABLE STORAGE_CLASS(
LAST_UPDATE_HOST_NAME VARCHAR(100) CONSTRAINT STORAGE_CLASS_LUHN_NN NOT NULL,
LAST_UPDATE_TIME UINT64TYPE CONSTRAINT STORAGE_CLASS_LUT_NN NOT NULL,
CONSTRAINT STORAGE_CLASS_PK PRIMARY KEY(STORAGE_CLASS_ID),
CONSTRAINT STORAGE_CLASS_SCN_UN UNIQUE(STORAGE_CLASS_NAME)
CONSTRAINT STORAGE_CLASS_SCN_UN UNIQUE(STORAGE_CLASS_NAME),
CONSTRAINT STORAGE_CLASS_VOI_FK FOREIGN KEY(VIRTUAL_ORGANIZATION_ID) REFERENCES VIRTUAL_ORGANIZATION(VIRTUAL_ORGANIZATION_ID)
);
CREATE TABLE TAPE_POOL(
TAPE_POOL_ID UINT64TYPE CONSTRAINT TAPE_POOL_TPI_NN NOT NULL,
......@@ -54,6 +62,7 @@ CREATE TABLE TAPE_POOL(
NB_PARTIAL_TAPES UINT64TYPE CONSTRAINT TAPE_POOL_NPT_NN NOT NULL,
IS_ENCRYPTED CHAR(1) CONSTRAINT TAPE_POOL_IE_NN NOT NULL,
SUPPLY VARCHAR(100),
VIRTUAL_ORGANIZATION_ID UINT64TYPE,
USER_COMMENT VARCHAR(1000) CONSTRAINT TAPE_POOL_UC_NN NOT NULL,
CREATION_LOG_USER_NAME VARCHAR(100) CONSTRAINT TAPE_POOL_CLUN_NN NOT NULL,
CREATION_LOG_HOST_NAME VARCHAR(100) CONSTRAINT TAPE_POOL_CLHN_NN NOT NULL,
......@@ -63,7 +72,8 @@ CREATE TABLE TAPE_POOL(
LAST_UPDATE_TIME UINT64TYPE CONSTRAINT TAPE_POOL_LUT_NN NOT NULL,
CONSTRAINT TAPE_POOL_PK PRIMARY KEY(TAPE_POOL_ID),
CONSTRAINT TAPE_POOL_TPN_UN UNIQUE(TAPE_POOL_NAME),
CONSTRAINT TAPE_POOL_IS_ENCRYPTED_BOOL_CK CHECK(IS_ENCRYPTED IN ('0', '1'))
CONSTRAINT TAPE_POOL_IS_ENCRYPTED_BOOL_CK CHECK(IS_ENCRYPTED IN ('0', '1')),
CONSTRAINT TAPE_POOL_VO_FK FOREIGN KEY(VIRTUAL_ORGANIZATION_ID) REFERENCES VIRTUAL_ORGANIZATION(VIRTUAL_ORGANIZATION_ID)
);
CREATE TABLE ARCHIVE_ROUTE(
STORAGE_CLASS_ID UINT64TYPE CONSTRAINT ARCHIVE_ROUTE_SCI_NN NOT NULL,
......
......@@ -18,4 +18,8 @@ CREATE TABLE TAPE_POOL_ID(
CONSTRAINT TAPE_POOL_ID_PK PRIMARY KEY(ID)
);
INSERT INTO TAPE_POOL_ID(ID) VALUES(1);
CREATE TABLE VIRTUAL_ORGANIZATION_ID(
ID UINT64TYPE,
CONSTRAINT VIRTUAL_ORGANIZATION_ID_PK PRIMARY KEY(ID)
);
INSERT INTO VIRTUAL_ORGANIZATION_ID(ID) VALUES(1);
......@@ -30,6 +30,14 @@ CREATE SEQUENCE TAPE_POOL_ID_SEQ
NOCYCLE
CACHE 20
NOORDER;
CREATE SEQUENCE VIRTUAL_ORGANIZATION_ID_SEQ
INCREMENT BY 1
START WITH 4294967296
NOMAXVALUE
MINVALUE 1
NOCYCLE
CACHE 20
NOORDER;
CREATE GLOBAL TEMPORARY TABLE TEMP_TAPE_FILE_INSERTION_BATCH(
VID VARCHAR(100),
FSEQ UINT64TYPE ,
......
......@@ -26,3 +26,10 @@ CREATE SEQUENCE TAPE_POOL_ID_SEQ
MINVALUE 1
NO CYCLE
CACHE 20;
CREATE SEQUENCE VIRTUAL_ORGANIZATION_ID_SEQ
INCREMENT BY 1
START WITH 1
NO MAXVALUE
MINVALUE 1
NO CYCLE
CACHE 20;
......@@ -10,3 +10,6 @@ CREATE TABLE STORAGE_CLASS_ID(
CREATE TABLE TAPE_POOL_ID(
ID INTEGER PRIMARY KEY AUTOINCREMENT
);
CREATE TABLE VIRTUAL_ORGANIZATION_ID(
ID INTEGER PRIMARY KEY AUTOINCREMENT
);