[icinga-checkins] icinga.org: icinga-core/next: update db schema to 1.9.0, add upgrade sqls

git at icinga.org git at icinga.org
Tue Oct 30 17:30:14 CET 2012


Module: icinga-core
Branch: next
Commit: 0c6c56c35bc391ac2f786de2c88c9e52bb4364eb
URL:    https://git.icinga.org/?p=icinga-core.git;a=commit;h=0c6c56c35bc391ac2f786de2c88c9e52bb4364eb

Author: Michael Friedrich <michael.friedrich at gmail.com>
Date:   Tue Oct 30 17:29:10 2012 +0100

update db schema to 1.9.0, add upgrade sqls

---

 module/idoutils/db/mysql/mysql.sql                 |    2 +-
 .../db/mysql/upgrade/mysql-upgrade-1.9.0.sql       |   19 +++++++
 module/idoutils/db/oracle/oracle.sql               |    2 +-
 .../db/oracle/upgrade/oracle-upgrade-1.9.0.sql     |   55 ++++++++++++++++++++
 module/idoutils/db/pgsql/pgsql.sql                 |    2 +-
 .../db/pgsql/upgrade/pgsql-upgrade-1.9.0.sql       |   19 +++++++
 module/idoutils/db/scripts/installdb.in            |    2 +-
 module/idoutils/include/common.h                   |    2 +-
 update-version-schema                              |    4 +-
 9 files changed, 100 insertions(+), 7 deletions(-)

diff --git a/module/idoutils/db/mysql/mysql.sql b/module/idoutils/db/mysql/mysql.sql
index 881f0cf..f7d57f1 100644
--- a/module/idoutils/db/mysql/mysql.sql
+++ b/module/idoutils/db/mysql/mysql.sql
@@ -1600,6 +1600,6 @@ CREATE INDEX tperiod_tid_d_ss_es ON icinga_timeperiod_timeranges (timeperiod_id,
 -- -----------------------------------------
 -- set dbversion
 -- -----------------------------------------
-INSERT INTO icinga_dbversion (name, version, create_time, modify_time) VALUES ('idoutils', '1.8.0', NOW(), NOW()) ON DUPLICATE KEY UPDATE version='1.8.0', modify_time=NOW();
+INSERT INTO icinga_dbversion (name, version, create_time, modify_time) VALUES ('idoutils', '1.9.0', NOW(), NOW()) ON DUPLICATE KEY UPDATE version='1.9.0', modify_time=NOW();
 
 
diff --git a/module/idoutils/db/mysql/upgrade/mysql-upgrade-1.9.0.sql b/module/idoutils/db/mysql/upgrade/mysql-upgrade-1.9.0.sql
new file mode 100644
index 0000000..aedffec
--- /dev/null
+++ b/module/idoutils/db/mysql/upgrade/mysql-upgrade-1.9.0.sql
@@ -0,0 +1,19 @@
+-- -----------------------------------------
+-- upgrade path for Icinga IDOUtils 1.9.0
+--
+-- -----------------------------------------
+-- Copyright (c) 2012-2013 Icinga Development Team (http://www.icinga.org)
+--
+-- Please check http://docs.icinga.org for upgrading information!
+-- -----------------------------------------
+
+-- -----------------------------------------
+-- 
+-- -----------------------------------------
+
+-- -----------------------------------------
+-- update dbversion
+-- -----------------------------------------
+
+INSERT INTO icinga_dbversion (name, version, create_time, modify_time) VALUES ('idoutils', '1.9.0', NOW(), NOW()) ON DUPLICATE KEY UPDATE version='1.9.0', modify_time=NOW();
+
diff --git a/module/idoutils/db/oracle/oracle.sql b/module/idoutils/db/oracle/oracle.sql
index 101516b..d3ff55e 100644
--- a/module/idoutils/db/oracle/oracle.sql
+++ b/module/idoutils/db/oracle/oracle.sql
@@ -21,7 +21,7 @@
 -- -- --------------------------------------------------------
 */
 
-DEFINE ICINGA_VERSION=1.8.0
+DEFINE ICINGA_VERSION=1.9.0
 
 -- -----------------------------------------
 -- set defines
diff --git a/module/idoutils/db/oracle/upgrade/oracle-upgrade-1.9.0.sql b/module/idoutils/db/oracle/upgrade/oracle-upgrade-1.9.0.sql
new file mode 100644
index 0000000..47c9703
--- /dev/null
+++ b/module/idoutils/db/oracle/upgrade/oracle-upgrade-1.9.0.sql
@@ -0,0 +1,55 @@
+-- -----------------------------------------
+-- upgrade path for Icinga IDOUtils 1.9.0
+--
+-- run it as icinga database user from directory of this file
+-- sqlplus icinga@<instance> @ oracle-upgrade-1.9.0.sql
+-- -----------------------------------------
+-- Copyright (c) 2012-2013 Icinga Development Team (http://www.icinga.org)
+--
+-- Please check http://docs.icinga.org for upgrading information!
+-- -----------------------------------------
+set sqlprompt "&&_USER@&&_CONNECT_IDENTIFIER SQL>"
+set pagesize 200;
+set linesize 200;
+set heading on;
+set echo on;
+set feedback on;
+
+define ICINGA_VERSION=1.9.0
+
+-- --------------------------------------------------------
+-- warning:edit this script to define existing tablespaces
+-- this particular step can be skipped safetly if no new table or index included
+-- --------------------------------------------------------
+/* set real TBS names on which you have quota, no checks are implemented!*/
+define DATATBS='ICINGA_DATA1';
+define LOBTBS='ICINGA_LOB1';
+define IDXTBS='ICINGA_IDX1';
+
+/* load defines from file, if any */
+ at ../icinga_defines.sql
+
+/* script will be terminated on the first error */
+whenever sqlerror exit failure
+spool oracle-upgrade-&&ICINGA_VERSION..log
+
+-- -----------------------------------------
+-- 
+-- -----------------------------------------
+-- finally update dbversion
+-- -----------------------------------------
+
+MERGE INTO dbversion
+	USING DUAL ON (name='idoutils')
+	WHEN MATCHED THEN
+		UPDATE SET version='&&ICINGA_VERSION', modify_time=CURRENT_TIMESTAMP
+	WHEN NOT MATCHED THEN
+		INSERT (id, name, version, create_time, modify_time) VALUES ('1', 'idoutils', '&&ICINGA_VERSION', CURRENT_TIMESTAMP, CURRENT_TIMESTAMP);
+
+/* last check */
+select object_name,object_type,status  from user_objects where status !='VALID';
+
+/* goodbye */
+spool off
+exit;
+
diff --git a/module/idoutils/db/pgsql/pgsql.sql b/module/idoutils/db/pgsql/pgsql.sql
index 6c21303..e39f9ca 100644
--- a/module/idoutils/db/pgsql/pgsql.sql
+++ b/module/idoutils/db/pgsql/pgsql.sql
@@ -1629,5 +1629,5 @@ CREATE INDEX tperiod_tid_d_ss_es ON icinga_timeperiod_timeranges (timeperiod_id,
 -- set dbversion
 -- -----------------------------------------
 
-SELECT updatedbversion('1.8.0');
+SELECT updatedbversion('1.9.0');
 
diff --git a/module/idoutils/db/pgsql/upgrade/pgsql-upgrade-1.9.0.sql b/module/idoutils/db/pgsql/upgrade/pgsql-upgrade-1.9.0.sql
new file mode 100644
index 0000000..a738658
--- /dev/null
+++ b/module/idoutils/db/pgsql/upgrade/pgsql-upgrade-1.9.0.sql
@@ -0,0 +1,19 @@
+-- -----------------------------------------
+-- upgrade path for Icinga IDOUtils 1.9.0
+--
+-- -----------------------------------------
+-- Copyright (c) 2012-2013 Icinga Development Team (http://www.icinga.org)
+--
+-- Please check http://docs.icinga.org for upgrading information!
+-- -----------------------------------------
+
+-- -----------------------------------------
+-- 
+-- -----------------------------------------
+
+-- -----------------------------------------
+-- update dbversion
+-- -----------------------------------------
+
+SELECT updatedbversion('1.9.0');
+
diff --git a/module/idoutils/db/scripts/installdb.in b/module/idoutils/db/scripts/installdb.in
index 4c53b2d..539aa0d 100755
--- a/module/idoutils/db/scripts/installdb.in
+++ b/module/idoutils/db/scripts/installdb.in
@@ -45,7 +45,7 @@ my $dbh = DBI->connect("DBI:mysql:database=$database;host=$hostname",
 		or die "Cannot connect to database";
 
 # Current database version
-my $thisversion="1.8.0";
+my $thisversion="1.9.0";
 
 # Create version table if it doesn't exist
 eval { $dbh->do("SELECT * FROM icinga_dbversion LIMIT 1") };
diff --git a/module/idoutils/include/common.h b/module/idoutils/include/common.h
index 01e74a0..2747c36 100644
--- a/module/idoutils/include/common.h
+++ b/module/idoutils/include/common.h
@@ -25,7 +25,7 @@
 #define IDO_DATE "04-25-2013"
 #define IDO_VERSION "1.9.0dev"
 
-#define IDO_SCHEMA_VERSION "1.8.0"
+#define IDO_SCHEMA_VERSION "1.9.0"
 
 #define IDO_COPYRIGHT 		"Copyright(c) 2005-2008 Ethan Galstad, Copyright(c) 2009-2012 Icinga Development Team (https://www.icinga.org)"
 #define IDO_LICENSE 		"License: GPL v2"
diff --git a/update-version-schema b/update-version-schema
index e263923..24a41e2 100755
--- a/update-version-schema
+++ b/update-version-schema
@@ -10,10 +10,10 @@ else
 fi
 
 # Current version number
-CURRENTVERSION=1.8.0
+CURRENTVERSION=1.9.0
 
 # Last date
-LASTDATE=08-20-2012
+LASTDATE=10-30-2012
 
 if [ "x$1" = "x" ]
 then





More information about the icinga-checkins mailing list