From 3fd20d56aaed772aad661190620631ae9a08ee27 Mon Sep 17 00:00:00 2001 From: Michael Friedrich Date: Thu, 16 Oct 2014 12:11:10 +0200 Subject: [PATCH] DB IDO: Add program_version column to programstatus table Bump schema version to 1.11.8 fixes #7391 --- doc/1-about.md | 2 ++ lib/db_ido/dbconnection.cpp | 1 + lib/db_ido_mysql/idomysqlconnection.cpp | 2 +- lib/db_ido_mysql/schema/mysql.sql | 1 + lib/db_ido_mysql/schema/upgrade/2.2.0.sql | 17 +++++++++++++++++ lib/db_ido_pgsql/idopgsqlconnection.cpp | 2 +- lib/db_ido_pgsql/schema/pgsql.sql | 1 + lib/db_ido_pgsql/schema/upgrade/2.2.0.sql | 17 +++++++++++++++++ 8 files changed, 41 insertions(+), 2 deletions(-) create mode 100644 lib/db_ido_mysql/schema/upgrade/2.2.0.sql create mode 100644 lib/db_ido_pgsql/schema/upgrade/2.2.0.sql diff --git a/doc/1-about.md b/doc/1-about.md index a588715e0..0ffc31792 100644 --- a/doc/1-about.md +++ b/doc/1-about.md @@ -50,6 +50,8 @@ Icinga 2 is available as [Vagrant Demo VM](#vagrant). #### Changes +* DB IDO schema update to version `1.11.8` + * schema files in `lib/db_ido_{mysql,pgsql}/schema` * New CLI commands #7245 * `icinga2-{enable,disable}-feature` tool = cli command `icinga2 feature {enable,disable}` #7250 * `icinga2-list-objects` tool = cli command `icinga2 object list` #7251 diff --git a/lib/db_ido/dbconnection.cpp b/lib/db_ido/dbconnection.cpp index 92dd437ff..cc6c3f70c 100644 --- a/lib/db_ido/dbconnection.cpp +++ b/lib/db_ido/dbconnection.cpp @@ -118,6 +118,7 @@ void DbConnection::ProgramStatusHandler(void) query2.Fields = make_shared(); query2.Fields->Set("instance_id", 0); /* DbConnection class fills in real ID */ + query2.Fields->Set("program_version", Application::GetVersion()); query2.Fields->Set("status_update_time", DbValue::FromTimestamp(Utility::GetTime())); query2.Fields->Set("program_start_time", DbValue::FromTimestamp(Application::GetStartTime())); query2.Fields->Set("is_currently_running", 1); diff --git a/lib/db_ido_mysql/idomysqlconnection.cpp b/lib/db_ido_mysql/idomysqlconnection.cpp index 61b4f5060..df75ef44a 100644 --- a/lib/db_ido_mysql/idomysqlconnection.cpp +++ b/lib/db_ido_mysql/idomysqlconnection.cpp @@ -34,7 +34,7 @@ using namespace icinga; -#define SCHEMA_VERSION "1.11.7" +#define SCHEMA_VERSION "1.11.8" REGISTER_TYPE(IdoMysqlConnection); REGISTER_STATSFUNCTION(IdoMysqlConnectionStats, &IdoMysqlConnection::StatsFunc); diff --git a/lib/db_ido_mysql/schema/mysql.sql b/lib/db_ido_mysql/schema/mysql.sql index 6d50aa048..d006665e1 100644 --- a/lib/db_ido_mysql/schema/mysql.sql +++ b/lib/db_ido_mysql/schema/mysql.sql @@ -897,6 +897,7 @@ CREATE TABLE IF NOT EXISTS icinga_processevents ( CREATE TABLE IF NOT EXISTS icinga_programstatus ( programstatus_id bigint(20) unsigned NOT NULL AUTO_INCREMENT, instance_id bigint unsigned default 0, + program_version varchar(64) character set latin1 collate latin1_general_cs default NULL, status_update_time timestamp default '0000-00-00 00:00:00', program_start_time timestamp default '0000-00-00 00:00:00', program_end_time timestamp default '0000-00-00 00:00:00', diff --git a/lib/db_ido_mysql/schema/upgrade/2.2.0.sql b/lib/db_ido_mysql/schema/upgrade/2.2.0.sql new file mode 100644 index 000000000..ceb9465c0 --- /dev/null +++ b/lib/db_ido_mysql/schema/upgrade/2.2.0.sql @@ -0,0 +1,17 @@ +-- ----------------------------------------- +-- upgrade path for Icinga 2.2.0 +-- +-- ----------------------------------------- +-- Copyright (c) 2014 Icinga Development Team (http://www.icinga.org) +-- +-- Please check http://docs.icinga.org for upgrading information! +-- ----------------------------------------- + +ALTER TABLE `icinga_programstatus` ADD COLUMN `program_version` varchar(64) character set latin1 collate latin1_general_cs default NULL; + +-- ----------------------------------------- +-- update dbversion +-- ----------------------------------------- + +INSERT INTO icinga_dbversion (name, version, create_time, modify_time) VALUES ('idoutils', '1.11.8', NOW(), NOW()) ON DUPLICATE KEY UPDATE version='1.11.8', modify_time=NOW(); + diff --git a/lib/db_ido_pgsql/idopgsqlconnection.cpp b/lib/db_ido_pgsql/idopgsqlconnection.cpp index cb14e5331..d77f84c43 100644 --- a/lib/db_ido_pgsql/idopgsqlconnection.cpp +++ b/lib/db_ido_pgsql/idopgsqlconnection.cpp @@ -35,7 +35,7 @@ using namespace icinga; -#define SCHEMA_VERSION "1.11.7" +#define SCHEMA_VERSION "1.11.8" REGISTER_TYPE(IdoPgsqlConnection); diff --git a/lib/db_ido_pgsql/schema/pgsql.sql b/lib/db_ido_pgsql/schema/pgsql.sql index 873508449..3bed499f2 100644 --- a/lib/db_ido_pgsql/schema/pgsql.sql +++ b/lib/db_ido_pgsql/schema/pgsql.sql @@ -924,6 +924,7 @@ CREATE TABLE icinga_processevents ( CREATE TABLE icinga_programstatus ( programstatus_id bigserial, instance_id bigint default 0, + program_version TEXT default NULL, status_update_time timestamp with time zone default '1970-01-01 00:00:00', program_start_time timestamp with time zone default '1970-01-01 00:00:00', program_end_time timestamp with time zone default '1970-01-01 00:00:00', diff --git a/lib/db_ido_pgsql/schema/upgrade/2.2.0.sql b/lib/db_ido_pgsql/schema/upgrade/2.2.0.sql new file mode 100644 index 000000000..f23adff0d --- /dev/null +++ b/lib/db_ido_pgsql/schema/upgrade/2.2.0.sql @@ -0,0 +1,17 @@ +-- ----------------------------------------- +-- upgrade path for Icinga 2.2.0 +-- +-- ----------------------------------------- +-- Copyright (c) 2014 Icinga Development Team (http://www.icinga.org) +-- +-- Please check http://docs.icinga.org for upgrading information! +-- ----------------------------------------- + +ALTER TABLE icinga_programstatus ADD COLUMN program_version TEXT default NULL; + +-- ----------------------------------------- +-- update dbversion +-- ----------------------------------------- + +SELECT updatedbversion('1.11.8'); +