Commit 88838db7 authored by Cedric Caffy's avatar Cedric Caffy
Browse files

[Catalogue] Preparing schema V4.0

- SUPERSEDED_BY_VID removed
- SUPERSEDED_BY_FSEQ removed
- RAO associated columns removed
- ARCHIVE_FILE_RECYCLE_BIN removed
- TAPE_FILE_RECYCLE_BIN removed
- Migration scripts
parent 7fd49c57
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
......@@ -264,29 +264,16 @@ CREATE TABLE TAPE_FILE(
COPY_NB UINT8TYPE CONSTRAINT TAPE_FILE_CN_NN NOT NULL,
CREATION_TIME UINT64TYPE CONSTRAINT TAPE_FILE_CT_NN NOT NULL,
ARCHIVE_FILE_ID UINT64TYPE CONSTRAINT TAPE_FILE_AFI_NN NOT NULL,
SUPERSEDED_BY_VID VARCHAR(100),
SUPERSEDED_BY_FSEQ UINT64TYPE ,
WRITE_START_WRAP UINT16TYPE,
WRITE_START_LPOS UINT32TYPE,
WRITE_END_WRAP UINT16TYPE,
WRITE_END_LPOS UINT32TYPE,
READ_START_WRAP UINT16TYPE,
READ_START_LPOS UINT32TYPE,
READ_END_WRAP UINT16TYPE,
READ_END_LPOS UINT32TYPE,
CONSTRAINT TAPE_FILE_PK PRIMARY KEY(VID, FSEQ),
CONSTRAINT TAPE_FILE_TAPE_FK FOREIGN KEY(VID)
REFERENCES TAPE(VID),
CONSTRAINT TAPE_FILE_ARCHIVE_FILE_FK FOREIGN KEY(ARCHIVE_FILE_ID)
REFERENCES ARCHIVE_FILE(ARCHIVE_FILE_ID),
CONSTRAINT TAPE_FILE_VID_BLOCK_ID_UN UNIQUE(VID, BLOCK_ID),
CONSTRAINT TAPE_FILE_COPY_NB_GT_0_CK CHECK(COPY_NB > 0),
CONSTRAINT TAPE_FILE_SS_VID_FSEQ_FK FOREIGN KEY(SUPERSEDED_BY_VID, SUPERSEDED_BY_FSEQ)
REFERENCES TAPE_FILE(VID, FSEQ)
CONSTRAINT TAPE_FILE_COPY_NB_GT_0_CK CHECK(COPY_NB > 0)
);
CREATE INDEX TAPE_FILE_VID_IDX ON TAPE_FILE(VID);
CREATE INDEX TAPE_FILE_ARCHIVE_FILE_ID_IDX ON TAPE_FILE(ARCHIVE_FILE_ID);
CREATE INDEX TAPE_FILE_SBV_SBF_IDX ON TAPE_FILE(SUPERSEDED_BY_VID, SUPERSEDED_BY_FSEQ);
CREATE TABLE ACTIVITIES_WEIGHTS (
DISK_INSTANCE_NAME VARCHAR(100),
ACTIVITY VARCHAR(100),
......@@ -299,54 +286,6 @@ CREATE TABLE ACTIVITIES_WEIGHTS (
LAST_UPDATE_HOST_NAME VARCHAR(100) CONSTRAINT ACTIV_WEIGHTS_LUHN_NN NOT NULL,
LAST_UPDATE_TIME UINT64TYPE CONSTRAINT ACTIV_WEIGHTS_LUT_NN NOT NULL
);
CREATE TABLE ARCHIVE_FILE_RECYCLE_BIN(
ARCHIVE_FILE_ID UINT64TYPE CONSTRAINT ARCHIVE_FILE_RB_AFI_NN NOT NULL,
DISK_INSTANCE_NAME VARCHAR(100) CONSTRAINT ARCHIVE_FILE_RB_DIN_NN NOT NULL,
DISK_FILE_ID VARCHAR(100) CONSTRAINT ARCHIVE_FILE_RB_DFI_NN NOT NULL,
DISK_FILE_ID_WHEN_DELETED VARCHAR(100) CONSTRAINT ARCHIVE_FILE_RB_DFIWD_NN NOT NULL,
DISK_FILE_UID UINT32TYPE CONSTRAINT ARCHIVE_FILE_RB_DFUID_NN NOT NULL,
DISK_FILE_GID UINT32TYPE CONSTRAINT ARCHIVE_FILE_RB_DFGID_NN NOT NULL,
SIZE_IN_BYTES UINT64TYPE CONSTRAINT ARCHIVE_FILE_RB_SIB_NN NOT NULL,
CHECKSUM_BLOB CHECKSUM_BLOB_TYPE,
CHECKSUM_ADLER32 UINT32TYPE CONSTRAINT ARCHIVE_FILE_RB_CB2_NN NOT NULL,
STORAGE_CLASS_ID UINT64TYPE CONSTRAINT ARCHIVE_FILE_RB_SCI_NN NOT NULL,
CREATION_TIME UINT64TYPE CONSTRAINT ARCHIVE_FILE_RB_CT2_NN NOT NULL,
RECONCILIATION_TIME UINT64TYPE CONSTRAINT ARCHIVE_FILE_RB_RT_NN NOT NULL,
COLLOCATION_HINT VARCHAR(100),
DISK_FILE_PATH VARCHAR(2000) CONSTRAINT ARCHIVE_FILE_RB_DFP_NN NOT NULL,
DELETION_TIME UINT64TYPE CONSTRAINT ARCHIVE_FILE_RB_DT_NN NOT NULL,
CONSTRAINT ARCHIVE_FILE_RB_PK PRIMARY KEY(ARCHIVE_FILE_ID),
CONSTRAINT ARCHIVE_FILE_RB_SC_FK FOREIGN KEY(STORAGE_CLASS_ID) REFERENCES STORAGE_CLASS(STORAGE_CLASS_ID),
CONSTRAINT ARCHIVE_FILE_RB_DIN_DFI_UN UNIQUE(DISK_INSTANCE_NAME, DISK_FILE_ID)
);
CREATE TABLE TAPE_FILE_RECYCLE_BIN(
VID VARCHAR(100) CONSTRAINT TAPE_FILE_RB_V_NN NOT NULL,
FSEQ UINT64TYPE CONSTRAINT TAPE_FILE_RB_F_NN NOT NULL,
BLOCK_ID UINT64TYPE CONSTRAINT TAPE_FILE_RB_BI_NN NOT NULL,
LOGICAL_SIZE_IN_BYTES UINT64TYPE CONSTRAINT TAPE_FILE_RB_CSIB_NN NOT NULL,
COPY_NB UINT8TYPE CONSTRAINT TAPE_FILE_RB_CN_NN NOT NULL,
CREATION_TIME UINT64TYPE CONSTRAINT TAPE_FILE_RB_CT_NN NOT NULL,
ARCHIVE_FILE_ID UINT64TYPE CONSTRAINT TAPE_FILE_RB_AFI_NN NOT NULL,
SUPERSEDED_BY_VID VARCHAR(100),
SUPERSEDED_BY_FSEQ UINT64TYPE,
WRITE_START_WRAP UINT16TYPE,
WRITE_START_LPOS UINT32TYPE,
WRITE_END_WRAP UINT16TYPE,
WRITE_END_LPOS UINT32TYPE,
READ_START_WRAP UINT16TYPE,
READ_START_LPOS UINT32TYPE,
READ_END_WRAP UINT16TYPE,
READ_END_LPOS UINT32TYPE,
CONSTRAINT TAPE_FILE_RB_PK PRIMARY KEY(VID, FSEQ),
CONSTRAINT TAPE_FILE_RB_TAPE_FK FOREIGN KEY(VID)
REFERENCES TAPE(VID),
CONSTRAINT TAPE_FILE_RB_ARCHIVE_FILE_FK FOREIGN KEY(ARCHIVE_FILE_ID)
REFERENCES ARCHIVE_FILE_RECYCLE_BIN(ARCHIVE_FILE_ID),
CONSTRAINT TAPE_FILE_RB_VID_BLOCK_ID_UN UNIQUE(VID, BLOCK_ID),
CONSTRAINT TAPE_FILE_RB_COPY_NB_GT_0_CK CHECK(COPY_NB > 0),
CONSTRAINT TAPE_FILE_RB_SS_VID_FSEQ_FK FOREIGN KEY(SUPERSEDED_BY_VID, SUPERSEDED_BY_FSEQ)
REFERENCES TAPE_FILE_RECYCLE_BIN(VID, FSEQ)
);
CREATE TABLE FILE_RECYCLE_LOG(
FILE_RECYCLE_LOG_ID UINT64TYPE CONSTRAINT FILE_RECYCLE_LOG_ID_NN NOT NULL,
VID VARCHAR(100) CONSTRAINT FILE_RECYCLE_LOG_VID_NN NOT NULL,
......
--liquibase formatted sql
--changeset ccaffy:1 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='UPGRADING';
UPDATE CTA_CATALOGUE SET NEXT_SCHEMA_VERSION_MAJOR=4;
UPDATE CTA_CATALOGUE SET NEXT_SCHEMA_VERSION_MINOR=0;
--rollback UPDATE CTA_CATALOGUE SET NEXT_SCHEMA_VERSION_MAJOR=NULL;
--rollback UPDATE CTA_CATALOGUE SET NEXT_SCHEMA_VERSION_MINOR=NULL;
--rollback UPDATE CTA_CATALOGUE SET STATUS='PRODUCTION';
--changeset ccaffy:2 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_FILE DROP CONSTRAINT TAPE_FILE_SS_VID_FSEQ_FK;
--rollback ALTER TABLE TAPE_FILE ADD CONSTRAINT TAPE_FILE_SS_VID_FSEQ_FK FOREIGN KEY(SUPERSEDED_BY_VID, SUPERSEDED_BY_FSEQ) REFERENCES TAPE_FILE(VID, FSEQ);
--changeset ccaffy:3 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_FILE_SBV_SBF_IDX;
--rollback CREATE INDEX TAPE_FILE_SBV_SBF_IDX ON TAPE_FILE(SUPERSEDED_BY_VID, SUPERSEDED_BY_FSEQ);
--changeset ccaffy:4 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_FILE DROP COLUMN SUPERSEDED_BY_VID;
ALTER TABLE TAPE_FILE DROP COLUMN SUPERSEDED_BY_FSEQ;
ALTER TABLE TAPE_FILE DROP COLUMN WRITE_START_WRAP;
ALTER TABLE TAPE_FILE DROP COLUMN WRITE_START_LPOS;
ALTER TABLE TAPE_FILE DROP COLUMN WRITE_END_WRAP;
ALTER TABLE TAPE_FILE DROP COLUMN WRITE_END_LPOS;
ALTER TABLE TAPE_FILE DROP COLUMN READ_START_WRAP;
ALTER TABLE TAPE_FILE DROP COLUMN READ_START_LPOS;
ALTER TABLE TAPE_FILE DROP COLUMN READ_END_WRAP;
ALTER TABLE TAPE_FILE DROP COLUMN READ_END_LPOS;
--rollback ALTER TABLE TAPE_FILE ADD (
--rollback SUPERSEDED_BY_VID VARCHAR2(100),
--rollback SUPERSEDED_BY_FSEQ NUMERIC(20, 0),
--rollback WRITE_START_WRAP NUMERIC(5, 0),
--rollback WRITE_START_LPOS NUMERIC(10, 0),
--rollback WRITE_END_WRAP NUMERIC(5, 0),
--rollback WRITE_END_LPOS NUMERIC(10, 0),
--rollback READ_START_WRAP NUMERIC(5, 0),
--rollback READ_START_LPOS NUMERIC(10, 0),
--rollback READ_END_WRAP NUMERIC(5, 0),
--rollback READ_END_LPOS NUMERIC(10, 0)
--rollback );
--changeset ccaffy:5 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 TABLE TAPE_FILE_RECYCLE_BIN;
--rollback CREATE TABLE TAPE_FILE_RECYCLE_BIN(
--rollback VID VARCHAR2(100) CONSTRAINT TAPE_FILE_RB_V_NN NOT NULL,
--rollback FSEQ NUMERIC(20, 0) CONSTRAINT TAPE_FILE_RB_F_NN NOT NULL,
--rollback BLOCK_ID NUMERIC(20, 0) CONSTRAINT TAPE_FILE_RB_BI_NN NOT NULL,
--rollback LOGICAL_SIZE_IN_BYTES NUMERIC(20, 0) CONSTRAINT TAPE_FILE_RB_CSIB_NN NOT NULL,
--rollback COPY_NB NUMERIC(3, 0) CONSTRAINT TAPE_FILE_RB_CN_NN NOT NULL,
--rollback CREATION_TIME NUMERIC(20, 0) CONSTRAINT TAPE_FILE_RB_CT_NN NOT NULL,
--rollback ARCHIVE_FILE_ID NUMERIC(20, 0) CONSTRAINT TAPE_FILE_RB_AFI_NN NOT NULL,
--rollback SUPERSEDED_BY_VID VARCHAR2(100),
--rollback SUPERSEDED_BY_FSEQ NUMERIC(20, 0),
--rollback WRITE_START_WRAP NUMERIC(5, 0),
--rollback WRITE_START_LPOS NUMERIC(10, 0),
--rollback WRITE_END_WRAP NUMERIC(5, 0),
--rollback WRITE_END_LPOS NUMERIC(10, 0),
--rollback READ_START_WRAP NUMERIC(5, 0),
--rollback READ_START_LPOS NUMERIC(10, 0),
--rollback READ_END_WRAP NUMERIC(5, 0),
--rollback READ_END_LPOS NUMERIC(10, 0),
--rollback CONSTRAINT TAPE_FILE_RB_PK PRIMARY KEY(VID, FSEQ),
--rollback CONSTRAINT TAPE_FILE_RB_TAPE_FK FOREIGN KEY(VID)
--rollback REFERENCES TAPE(VID),
--rollback CONSTRAINT TAPE_FILE_RB_ARCHIVE_FILE_FK FOREIGN KEY(ARCHIVE_FILE_ID)
--rollback REFERENCES ARCHIVE_FILE_RECYCLE_BIN(ARCHIVE_FILE_ID),
--rollback CONSTRAINT TAPE_FILE_RB_VID_BLOCK_ID_UN UNIQUE(VID, BLOCK_ID),
--rollback CONSTRAINT TAPE_FILE_RB_COPY_NB_GT_0_CK CHECK(COPY_NB > 0),
--rollback CONSTRAINT TAPE_FILE_RB_SS_VID_FSEQ_FK FOREIGN KEY(SUPERSEDED_BY_VID, SUPERSEDED_BY_FSEQ)
--rollback REFERENCES TAPE_FILE_RECYCLE_BIN(VID, FSEQ)
--rollback );
--changeset ccaffy:6 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 TABLE ARCHIVE_FILE_RECYCLE_BIN;
--rollback CREATE TABLE ARCHIVE_FILE_RECYCLE_BIN(
--rollback ARCHIVE_FILE_ID NUMERIC(20, 0) CONSTRAINT ARCHIVE_FILE_RB_AFI_NN NOT NULL,
--rollback DISK_INSTANCE_NAME VARCHAR2(100) CONSTRAINT ARCHIVE_FILE_RB_DIN_NN NOT NULL,
--rollback DISK_FILE_ID VARCHAR2(100) CONSTRAINT ARCHIVE_FILE_RB_DFI_NN NOT NULL,
--rollback DISK_FILE_ID_WHEN_DELETED VARCHAR2(100) CONSTRAINT ARCHIVE_FILE_RB_DFIWD_NN NOT NULL,
--rollback DISK_FILE_UID NUMERIC(10, 0) CONSTRAINT ARCHIVE_FILE_RB_DFUID_NN NOT NULL,
--rollback DISK_FILE_GID NUMERIC(10, 0) CONSTRAINT ARCHIVE_FILE_RB_DFGID_NN NOT NULL,
--rollback SIZE_IN_BYTES NUMERIC(20, 0) CONSTRAINT ARCHIVE_FILE_RB_SIB_NN NOT NULL,
--rollback CHECKSUM_BLOB RAW(200),
--rollback CHECKSUM_ADLER32 NUMERIC(10, 0) CONSTRAINT ARCHIVE_FILE_RB_CB2_NN NOT NULL,
--rollback STORAGE_CLASS_ID NUMERIC(20, 0) CONSTRAINT ARCHIVE_FILE_RB_SCI_NN NOT NULL,
--rollback CREATION_TIME NUMERIC(20, 0) CONSTRAINT ARCHIVE_FILE_RB_CT2_NN NOT NULL,
--rollback RECONCILIATION_TIME NUMERIC(20, 0) CONSTRAINT ARCHIVE_FILE_RB_RT_NN NOT NULL,
--rollback COLLOCATION_HINT VARCHAR2(100),
--rollback DISK_FILE_PATH VARCHAR2(2000) CONSTRAINT ARCHIVE_FILE_RB_DFP_NN NOT NULL,
--rollback DELETION_TIME NUMERIC(20, 0) CONSTRAINT ARCHIVE_FILE_RB_DT_NN NOT NULL,
--rollback CONSTRAINT ARCHIVE_FILE_RB_PK PRIMARY KEY(ARCHIVE_FILE_ID),
--rollback CONSTRAINT ARCHIVE_FILE_RB_SC_FK FOREIGN KEY(STORAGE_CLASS_ID) REFERENCES STORAGE_CLASS(STORAGE_CLASS_ID),
--rollback CONSTRAINT ARCHIVE_FILE_RB_DIN_DFI_UN UNIQUE(DISK_INSTANCE_NAME, DISK_FILE_ID)
--rollback );
--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;
UPDATE CTA_CATALOGUE SET STATUS='PRODUCTION';
UPDATE CTA_CATALOGUE SET SCHEMA_VERSION_MAJOR=4;
UPDATE CTA_CATALOGUE SET SCHEMA_VERSION_MINOR=0;
UPDATE CTA_CATALOGUE SET NEXT_SCHEMA_VERSION_MAJOR=NULL;
UPDATE CTA_CATALOGUE SET NEXT_SCHEMA_VERSION_MINOR=NULL;
--rollback UPDATE CTA_CATALOGUE SET STATUS='UPGRADING';
--rollback UPDATE CTA_CATALOGUE SET SCHEMA_VERSION_MAJOR=3;
--rollback UPDATE CTA_CATALOGUE SET SCHEMA_VERSION_MINOR=2;
--rollback UPDATE CTA_CATALOGUE SET NEXT_SCHEMA_VERSION_MAJOR=4;
--rollback UPDATE CTA_CATALOGUE SET NEXT_SCHEMA_VERSION_MINOR=0;
\ No newline at end of file
......@@ -4,8 +4,8 @@ set(CTA_RELEASE 1)
set(XROOTD_SSI_PROTOBUF_INTERFACE_VERSION "v0.0")
# Catalogue Schema Version
set(CTA_CATALOGUE_SCHEMA_VERSION_MAJOR 3)
set(CTA_CATALOGUE_SCHEMA_VERSION_MINOR 2)
set(CTA_CATALOGUE_SCHEMA_VERSION_MAJOR 4)
set(CTA_CATALOGUE_SCHEMA_VERSION_MINOR 0)
# Shared object internal version (used in SONAME)
set(CTA_SOVERSION 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