From c0f827ede8c7cbebf6e5d2b0e61e9443814298e2 Mon Sep 17 00:00:00 2001
From: mvelosob <miguel.veloso.barros@cern.ch>
Date: Thu, 31 Mar 2022 12:52:11 +0200
Subject: [PATCH] Fix release notes, migration script for release 4.6.1-1

---
 ReleaseNotes.md                               | 21 ++++++++++---------
 .../migrations/liquibase/oracle/4.5to4.6.sql  | 15 ++++++++-----
 2 files changed, 21 insertions(+), 15 deletions(-)

diff --git a/ReleaseNotes.md b/ReleaseNotes.md
index c9050ab7c6..ec1e6be233 100644
--- a/ReleaseNotes.md
+++ b/ReleaseNotes.md
@@ -8,26 +8,18 @@ This CTA release requires a backwards compatible database schema upgrade to CTA
 Please consult the [database upgrade documentation](https://eoscta.docs.cern.ch/catalogue/upgrade/).
 
 ### Features
-- cta/CTA#1123 - Add mount id to disk space reservations, prevent tape servers from releasing disk space from a previous mount
-- cta/CTA#1137 - Stop deletion of failed retrieve/archive requests
-- cta/CTA#1150 - Add option to pass desired catalogue version into cta-catalogue-schema-create
+- cta/CTA#1082 - Review software license text in CTA
 - cta/CTA#1163 - cta-admin now prefixes the drivename with a '!' if the respective logical library is disabled
 
 ### Bug fixes
-- cta/CTA#1117 - Update masterDataInBytes when writing files to tape
-- cta/CTA#1125 - cta-admin dr ls should show '-' instead of "NO_MOUNT" for Mount Type
-- cta/CTA#1138 - sortAndGetTapesForMountInfo only queries tapes in the current logical library
 
 ### Building and Packaging
-- cta/CTA#1082 - Review software license text in CTA
 
 ### Catalogue Schema
-- cta/CTA#1147 - Add Disk Instance Column to VO table
 - cta/CTA#1158 - Check all foreign key references have a full index on both sides of the constraint
+- cta/CTA#1043 - Add verification column to tape table
 
 ### Continuous Integration
-- cta/CTA#1126 - Create tests for TapeDrivesCatalogueState
-- cta/CTA#1131 - Compile CTA using devtoolset-8 in CI
 
 # v4.6.1-1
 
@@ -40,10 +32,19 @@ Please consult the [database upgrade documentation](https://tapeoperations.docs.
 
 ### Features
 - cta/CTA#1137 - Stop deletion of failed retrieve/archive requests
+- cta/CTA#1150 - Add option to pass desired catalogue version into cta-catalogue-schema-create
+- cta/CTA#1147 - Add Disk Instance Column to VO table
+- cta/CTA#1119 - Remove support of manual mode for loading tapes
+- cta/CTA#1123 - Add mount id to disk space reservations, prevent tape servers from releasing disk space from a previous mount
 
 ### Bug fixes
+- cta/CTA#1138 - sortAndGetTapesForMountInfo only queries tapes in the current logical library
+- cta/CTA#1117 - Update masterDataInBytes when writing files to tape
+- cta/CTA#1125 - cta-admin dr ls should show '-' instead of "NO_MOUNT" for Mount Type
 
 ### Continuous Integration
+- cta/CTA#1131 - Compile CTA using devtoolset-8 in CI
+- cta/CTA#1126 - Create tests for TapeDrivesCatalogueState
 
 # v4.6.0-1
 
diff --git a/catalogue/migrations/liquibase/oracle/4.5to4.6.sql b/catalogue/migrations/liquibase/oracle/4.5to4.6.sql
index 1800665ba3..11e2879240 100644
--- a/catalogue/migrations/liquibase/oracle/4.5to4.6.sql
+++ b/catalogue/migrations/liquibase/oracle/4.5to4.6.sql
@@ -3,8 +3,6 @@
 --changeset mvelosob:1 failOnError:true dbms:oracle
 --preconditions onFail:HALT onError:HALT
 --precondition-sql-check expectedResult:"4.5" SELECT CONCAT(CONCAT(CAST(SCHEMA_VERSION_MAJOR as VARCHAR(10)),'.'), CAST(SCHEMA_VERSION_MINOR AS VARCHAR(10))) AS CATALOGUE_VERSION FROM CTA_CATALOGUE;
---precondition-sql-check expectedResult:"0.0" SELECT CONCAT(CONCAT(CAST(SCHEMA_VERSION_MAJOR as VARCHAR(10)),'.'), CAST(SCHEMA_VERSION_MINOR AS VARCHAR(10))) AS CATALOGUE_VERSION FROM CTA_CATALOGUE;
---!!!THIS FALSE PRECONDITION IS HERE TO BLOCK AN UPGRADE WHILE THE DEVELOPMENT OF THE NEW CATALOGUE VERSION IS BEING DEVELOPED!!!
 UPDATE CTA_CATALOGUE SET STATUS='UPGRADING';
 UPDATE CTA_CATALOGUE SET NEXT_SCHEMA_VERSION_MAJOR=4;
 UPDATE CTA_CATALOGUE SET NEXT_SCHEMA_VERSION_MINOR=6;
@@ -22,11 +20,18 @@ UPDATE DISK_SYSTEM SET DISK_INSTANCE_NAME=NULL;
 --changeset mvelosob:3 failOnError:true dbms:oracle
 --preconditions onFail:HALT onError:HALT
 --precondition-sql-check expectedResult:"4.5" 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 DISK_SYSTEM ADD (DISK_INSTANCE_SPACE_NAME VARCHAR(100));
+UPDATE DISK_SYSTEM SET DISK_INSTANCE_SPACE_NAME=NULL;
+--rollback ALTER TABLE DISK_SYSTEM DROP COLUMN DISK_INSTANCE_SPACE_NAME
+
+--changeset mvelosob:4 failOnError:true dbms:oracle
+--preconditions onFail:HALT onError:HALT
+--precondition-sql-check expectedResult:"4.5" 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 DRIVE_STATE ADD (RESERVATION_SESSION_ID NUMERIC(20, 0));
 UPDATE DRIVE_STATE SET RESERVATION_SESSION_ID=0;
 --rollback ALTER TABLE DRIVE_STATE DROP COLUMN RESERVATION_SESSION_ID
 
---changeset mvelosob:4 failOnError:true dbms:oracle
+--changeset mvelosob:5 failOnError:true dbms:oracle
 --preconditions onFail:HALT onError:HALT
 --precondition-sql-check expectedResult:"4.5" 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 DRIVE_STATE DROP CONSTRAINT DRIVE_DSN_NN;
@@ -34,14 +39,14 @@ ALTER TABLE DRIVE_STATE DROP CONSTRAINT DRIVE_RB_NN;
 --rollback ALTER TABLE DRIVE_STATE MODIFY DISK_SYSTEM_NAME VARCHAR2(100) CONSTRAINT DRIVE_STATE_DSN_NN NOT NULL;
 --rollback ALTER TABLE DRIVE_STATE MODIFY RESERVED_BYTES NUMERIC(20, 0) CONSTRAINT DRIVE_STATE_RB_NN NOT NULL;
 
---changeset mvelosob:5 failOnError:true dbms:oracle
+--changeset mvelosob:6 failOnError:true dbms:oracle
 --preconditions onFail:HALT onError:HALT
 --precondition-sql-check expectedResult:"4.5" 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 VIRTUAL_ORGANIZATION ADD (DISK_INSTANCE_NAME VARCHAR2(100));
 UPDATE VIRTUAL_ORGANIZATION SET DISK_INSTANCE_NAME=NULL;
 --rollback ALTER TABLE VIRTUAL_ORGANIZATION DROP COLUMN DISK_INSTANCE_NAME
 
---changeset mvelosob:6 failOnError:true dbms:oracle
+--changeset mvelosob:7 failOnError:true dbms:oracle
 --preconditions onFail:HALT onError:HALT
 --precondition-sql-check expectedResult:"4.5" 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';
-- 
GitLab