Skip to content

Manual CTA Catalogue schema upgrade

Warning

This is not the recommended way to upgrade the CTA Catalogue schema, given its dependencies and complexity. Please consider the automated procedure, which provides a one-click upgrade solution for the CTA Catalogue schema upgrade.

Prerequisites

1. Choose a machine to run the upgrade

Warning

It should not be a production server!

The upgrade should be run from a machine running CERN CentOS 7. It is recommended to run the upgrade from the container provided by the CTA team.

2. Check the required tools are installed

3. Check the cta-catalogue.conf file contains the connection string for the database to be upgraded

This configuration file will be used by the cta-catalogue-schema-verify command.

Example:

$ cat /etc/cta/cta-catalogue.conf
oracle:cta_production/PASSWORD@cta

4. Upgrade the CTA software for the next catalogue release version

In order to perform a catalogue upgrade, the CTA version must be a Catalogue release one. These are identified as a bump in the major version. Examples: - v5.11.0.0-1 - v5.12.0.0-1

For detailed info check the Release Notes.

5. Obtain the migration script containing the changes to be applied to the database

The migration scripts are located in the cta-catalogue-schema project repository, in the folder: - cta-catalogue-schema/migrations/liquibase/

These files are named according to the following convention: <SOURCE_VERSION>to<DESTINATION_VERSION>.sql.

Example: - To upgrade between schema versions 14.0 and 15.0, use the file 14.0to15.0.sql.

Procedure to execute the manual schema upgrade

1. Set all drives down

> cta-admin dr down '.*' --reason upgrading

2. Verify the database schema is the version you wish to upgrade from

> cta-catalogue-schema-verify /etc/cta/cta-catalogue.conf
Schema version : 4.5
Checking indexes...
  SUCCESS
Checking tables, columns and constraints...
  SUCCESS
Status of the checking : SUCCESS

3. Upgrade the database using the Liquibase command

It is recommended to run the liquibase command in the same directory as the liquibase .properties file:

# JAVA_OPTS="-Doracle.net.tns_admin=/etc" liquibase --defaultsFile=./liquibase.properties --changeLogFile=/home/smurray/CTA/catalogue/migrations/liquibase/oracle/14.0to15.0.sql update

4. Verify the database schema has been successfully upgraded

# cta-catalogue-schema-verify /etc/cta/cta-catalogue.conf 
Schema version : 4.6
Checking indexes...
  SUCCESS
Checking tables, columns and constraints...
  SUCCESS
Status of the checking : SUCCESS