From 1d49e5c405a4474ecb05d138cddbcc9243cc2f42 Mon Sep 17 00:00:00 2001 From: Julian Brost Date: Thu, 16 Dec 2021 16:01:04 +0100 Subject: [PATCH] Make MySQL schema version in full schema file and upgrade files consistent In the 2.12.6 release, the full schema file sets the version to 1.14.3, whereas the latest available upgrade file 2.11.0.sql sets it to 1.15.0. Therefore, ship a new upgrade file 2.12.7.sql for all users who imported their schema with version 2.11.0 or later and never performed an upgrade since then. Their databases incorrectly state schema version 1.14.3 and is bumped to the correct version 1.15.0 by the upgrade. In the 2.13.2 release, the full schema file sets the version to 1.15.0, whereas the latest available upgrade file 2.13.0.sql sets it to 1.15.1. Therefore, rename the incorrectly named upgrade file 2.13.1.sql (it was not shipped in this or any other release so far) to 2.13.3.sql for users who imported their schema with version 2.13.0 or later and never performed an upgrade since then. Their databases incorrectly state schema version 1.15.0 and are bumped to the correct version 1.15.1 by the upgrade. Additionally, the version number in the full schema is also bumped to the correct version 1.15.1. --- lib/db_ido_mysql/schema/mysql.sql | 4 ++-- lib/db_ido_mysql/schema/upgrade/2.12.7.sql | 15 +++++++++++++++ lib/db_ido_mysql/schema/upgrade/2.13.3.sql | 15 +++++++++++++++ 3 files changed, 32 insertions(+), 2 deletions(-) create mode 100644 lib/db_ido_mysql/schema/upgrade/2.12.7.sql create mode 100644 lib/db_ido_mysql/schema/upgrade/2.13.3.sql diff --git a/lib/db_ido_mysql/schema/mysql.sql b/lib/db_ido_mysql/schema/mysql.sql index 59e59a7d3..020ba3ce5 100644 --- a/lib/db_ido_mysql/schema/mysql.sql +++ b/lib/db_ido_mysql/schema/mysql.sql @@ -1660,7 +1660,7 @@ CREATE INDEX idx_comments_remove ON icinga_comments (object_id, entry_time); -- ----------------------------------------- -- set dbversion -- ----------------------------------------- -INSERT INTO icinga_dbversion (name, version, create_time, modify_time) VALUES ('idoutils', '1.15.0', NOW(), NOW()) -ON DUPLICATE KEY UPDATE version='1.15.0', modify_time=NOW(); +INSERT INTO icinga_dbversion (name, version, create_time, modify_time) VALUES ('idoutils', '1.15.1', NOW(), NOW()) +ON DUPLICATE KEY UPDATE version='1.15.1', modify_time=NOW(); diff --git a/lib/db_ido_mysql/schema/upgrade/2.12.7.sql b/lib/db_ido_mysql/schema/upgrade/2.12.7.sql new file mode 100644 index 000000000..6319b37bd --- /dev/null +++ b/lib/db_ido_mysql/schema/upgrade/2.12.7.sql @@ -0,0 +1,15 @@ +-- ----------------------------------------- +-- upgrade path for Icinga 2.12.7 +-- +-- ----------------------------------------- +-- Icinga 2 | (c) 2021 Icinga GmbH | GPLv2+ +-- +-- Please check https://docs.icinga.com for upgrading information! +-- ----------------------------------------- + +SET SQL_MODE="NO_AUTO_VALUE_ON_ZERO"; + +-- ------------- +-- set dbversion +-- ------------- +INSERT INTO icinga_dbversion (name, version, create_time, modify_time) VALUES ('idoutils', '1.15.0', NOW(), NOW()) ON DUPLICATE KEY UPDATE version='1.15.0', modify_time=NOW(); diff --git a/lib/db_ido_mysql/schema/upgrade/2.13.3.sql b/lib/db_ido_mysql/schema/upgrade/2.13.3.sql new file mode 100644 index 000000000..577eb0a0b --- /dev/null +++ b/lib/db_ido_mysql/schema/upgrade/2.13.3.sql @@ -0,0 +1,15 @@ +-- ----------------------------------------- +-- upgrade path for Icinga 2.13.3 +-- +-- ----------------------------------------- +-- Icinga 2 | (c) 2021 Icinga GmbH | GPLv2+ +-- +-- Please check https://docs.icinga.com for upgrading information! +-- ----------------------------------------- + +SET SQL_MODE="NO_AUTO_VALUE_ON_ZERO"; + +-- ------------- +-- set dbversion +-- ------------- +INSERT INTO icinga_dbversion (name, version, create_time, modify_time) VALUES ('idoutils', '1.15.1', NOW(), NOW()) ON DUPLICATE KEY UPDATE version='1.15.1', modify_time=NOW();