Skip to content

Manual schema upgrade

The recommended way to upgrade the database schema is to use the schema upgrade container provided by the CTA team. The container provides an automated way to execute all of the steps below as a one-click upgrade.

Prerequisites for a manual schema upgrade

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.

Check the required tools are installed

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

Obtain the upgrade/changelog file containing the changes to be applied to the database

This file is located in the CTA project repository in the folder CTA/catalogue/migrations/liquibase/oracle/.

git clone https://:@gitlab.cern.ch:8443/cta/CTA.git

The file is named according to the following convention: SOURCE_VERSIONtoDESTINATION_VERSION.sql.

Example: to upgrade between schema versions 4.5 and 4.6, use the file 4.5to4.6.sql.

Procedure to execute the manual schema upgrade

Set all drives down

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

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

Upgrade the database using the Liquibase command

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

# JAVA_OPTS="-Doracle.net.tns_admin=/etc" liquibase --defaultsFile=./cta_production_frontend_liquibase.properties --changeLogFile=/home/smurray/CTA/catalogue/migrations/liquibase/oracle/4.5to4.6.sql update

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

Upgrade the CTA software

Once the DB upgrade has completed, you can proceed to upgrade the CTA software in the usual way.