From 759818d2894a4da5859b826cd860cc60f5805a19 Mon Sep 17 00:00:00 2001 From: Lee Clemens Date: Mon, 1 Feb 2016 19:26:55 -0500 Subject: [PATCH] DB IDO: Make check_source a varchar(255) column fixes #10069 Signed-off-by: Michael Friedrich --- lib/db_ido_mysql/schema/mysql.sql | 4 ++-- lib/db_ido_mysql/schema/upgrade/2.5.0.sql | 20 ++++++++++++++++++++ lib/db_ido_pgsql/schema/pgsql.sql | 6 +++--- lib/db_ido_pgsql/schema/upgrade/2.5.0.sql | 22 ++++++++++++++++++++++ 4 files changed, 47 insertions(+), 5 deletions(-) create mode 100644 lib/db_ido_mysql/schema/upgrade/2.5.0.sql create mode 100644 lib/db_ido_pgsql/schema/upgrade/2.5.0.sql diff --git a/lib/db_ido_mysql/schema/mysql.sql b/lib/db_ido_mysql/schema/mysql.sql index 01a557cd7..04377c760 100644 --- a/lib/db_ido_mysql/schema/mysql.sql +++ b/lib/db_ido_mysql/schema/mysql.sql @@ -713,7 +713,7 @@ CREATE TABLE IF NOT EXISTS icinga_hoststatus ( output TEXT character set latin1 default '', long_output TEXT default '', perfdata TEXT character set latin1 default '', - check_source TEXT character set latin1 default '', + check_source varchar(255) character set latin1 default '', current_state smallint default 0, has_been_checked smallint default 0, should_be_scheduled smallint default 0, @@ -1200,7 +1200,7 @@ CREATE TABLE IF NOT EXISTS icinga_servicestatus ( output TEXT character set latin1 default '', long_output TEXT default '', perfdata TEXT character set latin1 default '', - check_source TEXT character set latin1 default '', + check_source varchar(255) character set latin1 default '', current_state smallint default 0, has_been_checked smallint default 0, should_be_scheduled smallint default 0, diff --git a/lib/db_ido_mysql/schema/upgrade/2.5.0.sql b/lib/db_ido_mysql/schema/upgrade/2.5.0.sql new file mode 100644 index 000000000..b693cf32b --- /dev/null +++ b/lib/db_ido_mysql/schema/upgrade/2.5.0.sql @@ -0,0 +1,20 @@ +-- ----------------------------------------- +-- upgrade path for Icinga 2.5.0 +-- +-- ----------------------------------------- +-- Copyright (c) 2016 Icinga Development Team (http://www.icinga.org) +-- +-- Please check http://docs.icinga.org for upgrading information! +-- ----------------------------------------- + +-- ----------------------------------------- +-- #10069 IDO: check_source should not be a TEXT field +-- ----------------------------------------- + +ALTER TABLE icinga_hoststatus MODIFY COLUMN check_source varchar(255) character set latin1 default ''; +ALTER TABLE icinga_servicestatus MODIFY COLUMN check_source varchar(255) character set latin1 default ''; + +-- ----------------------------------------- +-- set dbversion +-- ----------------------------------------- +INSERT INTO icinga_dbversion (name, version, create_time, modify_time) VALUES ('idoutils', '1.14.1', NOW(), NOW()) ON DUPLICATE KEY UPDATE version='1.14.1', modify_time=NOW(); diff --git a/lib/db_ido_pgsql/schema/pgsql.sql b/lib/db_ido_pgsql/schema/pgsql.sql index 4184a1a9c..f81a00244 100644 --- a/lib/db_ido_pgsql/schema/pgsql.sql +++ b/lib/db_ido_pgsql/schema/pgsql.sql @@ -739,7 +739,7 @@ CREATE TABLE icinga_hoststatus ( output TEXT default '', long_output TEXT default '', perfdata TEXT default '', - check_source TEXT default '', + check_source varchar(255) default '', current_state INTEGER default 0, has_been_checked INTEGER default 0, should_be_scheduled INTEGER default 0, @@ -1226,7 +1226,7 @@ CREATE TABLE icinga_servicestatus ( output TEXT default '', long_output TEXT default '', perfdata TEXT default '', - check_source TEXT default '', + check_source varchar(255) default '', current_state INTEGER default 0, has_been_checked INTEGER default 0, should_be_scheduled INTEGER default 0, @@ -1323,7 +1323,7 @@ CREATE TABLE icinga_statehistory ( last_hard_state INTEGER default '-1', output TEXT default '', long_output TEXT default '', - check_source TEXT default '', + check_source varchar(255) default '', CONSTRAINT PK_statehistory_id PRIMARY KEY (statehistory_id) ) ; diff --git a/lib/db_ido_pgsql/schema/upgrade/2.5.0.sql b/lib/db_ido_pgsql/schema/upgrade/2.5.0.sql new file mode 100644 index 000000000..c851f711a --- /dev/null +++ b/lib/db_ido_pgsql/schema/upgrade/2.5.0.sql @@ -0,0 +1,22 @@ +-- ----------------------------------------- +-- upgrade path for Icinga 2.5.0 +-- +-- ----------------------------------------- +-- Copyright (c) 2016 Icinga Development Team (http://www.icinga.org) +-- +-- Please check http://docs.icinga.org for upgrading information! +-- ----------------------------------------- + +-- ----------------------------------------- +-- #10069 IDO: check_source should not be a TEXT field +-- ----------------------------------------- + +ALTER TABLE icinga_hoststatus ALTER COLUMN check_source TYPE varchar(255); +ALTER TABLE icinga_servicestatus ALTER COLUMN check_source TYPE varchar(255); +ALTER TABLE icinga_statehistory ALTER COLUMN check_source TYPE varchar(255); + +-- ----------------------------------------- +-- set dbversion +-- ----------------------------------------- + +SELECT updatedbversion('1.14.1');