Deprecated
This page is deprecated and may contain information that is no longer up to date.
Creating a new version of the Catalogue Schema¶
Introduction¶
The Catalogue schema is the description of the tables that represent the CTA Catalogue.
The Catalogue schema version number has the following format:
Example: 1.0, 1.1, 2.0
Warning
SCHEMA_VERSION_MAJOR
should be modified only if the changes made to the schema are not backward-compatible with the currently running version of CTA.
Danger
While starting, CTA checks the SCHEMA_VERSION_MAJOR
it is supposed to run against. If SCHEMA_VERSION_MAJOR
is not correct, CTA will not start.
Modifying the Catalogue schema¶
In order to make any changes to the CTA Catalogue schema, first a new schema version has to be created.
Danger
Do not modify any .sql
files without changing the version of the schema first (step 1 below)! If you do not update
the version, the current schema will be overwritten by any modifications you make. (Roll back by removing your changes
and rebuilding CTA). If in doubt, do a git diff
to check that the current schema directory (in the catalogue folder)
does not contain any changes.
To modify the Catalogue schema, follow these steps:
- Modify the compile-time constants
CTA_CATALOGUE_SCHEMA_VERSION_MAJOR
andCTA_CATALOGUE_SCHEMA_VERSION_MINOR
, found incmake/CTAVersions.cmake
. -
Run the build of cta-catalogue-schema
→ This will create a new folder that will be named according to the schema version variables modified in step 1.
→ Example: if the new schema version is 1.1, the directory 1.1 will be created in the catalogue directory.
-
Modify the schema by editing the
.sql
files located in the catalogue directory:- databasetype
_catalogue_schema_header.sql
common_catalogue_schema.sql
- databasetype
_catalogue_schema_trailer.sql
Where databasetype is
oracle
,postgres
orsqlite
. - databasetype
-
Run the build of cta-catalogue-schema
→ This will modify the files located in the folder created at step 2.
-
Try the new schema you created in an empty database. Your schema should work with Oracle, PostgreSQL and SQLite.
Tip
You can use cta-catalogue-schema-create
to create the new schema