Commit a4df3296 authored by Cedric CAFFY's avatar Cedric CAFFY
Browse files

The CTA Catalogue schema version number is now stored in CTAVersions.cmake

The insertion of the version of the Catalogue schema into the DB is now done when the schema sql files are generated. (catalogue/CMakeLists.txt)
The CTA_CATALOGUE_SCHEMA_VERSION_MAJOR and the CTA_CATALOGUE_SCHEMA_VERSION_MINOR are also inserted in version.hpp.in
parent 3223c45f
......@@ -96,10 +96,14 @@ target_link_libraries (ctacatalogue
ctacommon
ctardbms)
#Generate insert_cta_catalogue_version.sql
configure_file(${CMAKE_CURRENT_SOURCE_DIR}/insert_cta_catalogue_version.sql.in insert_cta_catalogue_version.sql)
add_custom_command (OUTPUT sqlite_catalogue_schema.sql mysql_catalogue_schema.sql oracle_catalogue_schema.sql postgres_catalogue_schema.sql
COMMAND cat
${CMAKE_CURRENT_SOURCE_DIR}/sqlite_catalogue_schema_header.sql
${CMAKE_CURRENT_SOURCE_DIR}/common_catalogue_schema.sql
insert_cta_catalogue_version.sql
${CMAKE_CURRENT_SOURCE_DIR}/sqlite_catalogue_schema_trailer.sql
| sed 's/UINT8TYPE/INTEGER/g'
| sed 's/UINT16TYPE/INTEGER/g'
......@@ -111,6 +115,7 @@ add_custom_command (OUTPUT sqlite_catalogue_schema.sql mysql_catalogue_schema.sq
COMMAND cat
${CMAKE_CURRENT_SOURCE_DIR}/mysql_catalogue_schema_header.sql
${CMAKE_CURRENT_SOURCE_DIR}/common_catalogue_schema.sql
insert_cta_catalogue_version.sql
${CMAKE_CURRENT_SOURCE_DIR}/mysql_catalogue_schema_trailer.sql
| sed 's/UINT8TYPE/TINYINT UNSIGNED/g'
| sed 's/UINT16TYPE/SMALLINT UNSIGNED/g'
......@@ -122,6 +127,7 @@ add_custom_command (OUTPUT sqlite_catalogue_schema.sql mysql_catalogue_schema.sq
COMMAND cat
${CMAKE_CURRENT_SOURCE_DIR}/oracle_catalogue_schema_header.sql
${CMAKE_CURRENT_SOURCE_DIR}/common_catalogue_schema.sql
insert_cta_catalogue_version.sql
${CMAKE_CURRENT_SOURCE_DIR}/oracle_catalogue_schema_trailer.sql
| sed 's/UINT8TYPE/NUMERIC\(3, 0\)/g'
| sed 's/UINT16TYPE/NUMERIC\(5, 0\)/g'
......@@ -133,6 +139,7 @@ add_custom_command (OUTPUT sqlite_catalogue_schema.sql mysql_catalogue_schema.sq
COMMAND cat
${CMAKE_CURRENT_SOURCE_DIR}/postgres_catalogue_schema_header.sql
${CMAKE_CURRENT_SOURCE_DIR}/common_catalogue_schema.sql
insert_cta_catalogue_version.sql
${CMAKE_CURRENT_SOURCE_DIR}/postgres_catalogue_schema_trailer.sql
| sed 's/UINT8TYPE/NUMERIC\(3, 0\)/g'
| sed 's/UINT16TYPE/NUMERIC\(5, 0\)/g'
......@@ -142,6 +149,7 @@ add_custom_command (OUTPUT sqlite_catalogue_schema.sql mysql_catalogue_schema.sq
> postgres_catalogue_schema.sql
DEPENDS
${CMAKE_CURRENT_SOURCE_DIR}/common_catalogue_schema.sql
${CMAKE_SOURCE_DIR}/cmake/CTAVersions.cmake
${CMAKE_CURRENT_SOURCE_DIR}/sqlite_catalogue_schema_header.sql
${CMAKE_CURRENT_SOURCE_DIR}/sqlite_catalogue_schema_trailer.sql
${CMAKE_CURRENT_SOURCE_DIR}/mysql_catalogue_schema_header.sql
......
......@@ -261,9 +261,3 @@ CREATE TABLE EXPERIMENTS (
NAME VARCHAR(20),
GID NUMERIC(6, 0) CONSTRAINT EXPERIMENTS_GID_PK PRIMARY KEY
);
INSERT INTO CTA_CATALOGUE(
SCHEMA_VERSION_MAJOR,
SCHEMA_VERSION_MINOR)
VALUES(
0,
0);
INSERT INTO CTA_CATALOGUE(
SCHEMA_VERSION_MAJOR,
SCHEMA_VERSION_MINOR)
VALUES(
@CTA_CATALOGUE_SCHEMA_VERSION_MAJOR@,
@CTA_CATALOGUE_SCHEMA_VERSION_MINOR@);
\ No newline at end of file
......@@ -2,6 +2,10 @@
set(CTA_VERSION 0)
set(CTA_RELEASE 1)
# Catalogue Schema Version
set(CTA_CATALOGUE_SCHEMA_VERSION_MAJOR 0)
set(CTA_CATALOGUE_SCHEMA_VERSION_MINOR 0)
# Shared object internal version (used in SONAME)
set(CTA_SOVERSION 0)
......
......@@ -20,3 +20,5 @@
#define CTA_VERSION "@CTA_VERSION@-@CTA_RELEASE@"
#define CTA_CATALOGUE_SCHEMA_VERSION_MAJOR @CTA_CATALOGUE_SCHEMA_VERSION_MAJOR@
#define CTA_CATALOGUE_SCHEMA_VERSION_MINOR @CTA_CATALOGUE_SCHEMA_VERSION_MINOR@
\ No newline at end of file
Supports Markdown
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