[icinga-checkins] icinga.org: icinga-core/mfriedrich/core: idoutils: reorder upgrade sqls, add dbversion to update-version script

git at icinga.org git at icinga.org
Wed Mar 16 09:14:02 CET 2011


Module: icinga-core
Branch: mfriedrich/core
Commit: 881309975919f8526ea1bc344af3c1adcdcae09f
URL:    https://git.icinga.org/?p=icinga-core.git;a=commit;h=881309975919f8526ea1bc344af3c1adcdcae09f

Author: Michael Friedrich <michael.friedrich at univie.ac.at>
Date:   Wed Mar 16 09:11:56 2011 +0100

idoutils: reorder upgrade sqls, add dbversion to update-version script

<rdbms>-upgrade-<version>.sql will be now located in <rdbms>/upgrade/

./update-version <version> now touches <rdbms>.sql too and modifies
the initial dbversion query to fit the current release.

---

 module/idoutils/db/mysql/mysql.sql                 |   12 +++++++-----
 .../db/mysql/{ => upgrade}/mysql-upgrade-0.8.3.sql |    0 
 .../db/mysql/{ => upgrade}/mysql-upgrade-1.0.1.sql |    0 
 .../mysql-upgrade-1.0.2-fix-object-relations.sql   |    0 
 .../db/mysql/{ => upgrade}/mysql-upgrade-1.0.2.sql |    0 
 .../db/mysql/{ => upgrade}/mysql-upgrade-1.0.3.sql |    0 
 .../db/mysql/{ => upgrade}/mysql-upgrade-1.0.sql   |    0 
 .../db/mysql/{ => upgrade}/mysql-upgrade-1.0rc.sql |    0 
 .../db/mysql/{ => upgrade}/mysql-upgrade-1.3.0.sql |    0 
 module/idoutils/db/oracle/oracle.sql               |   11 +++++++----
 .../oracle/{ => upgrade}/oracle-upgrade-1.0.1.sql  |    0 
 .../oracle-upgrade-1.0.2-fix-object-relations.sql  |    0 
 .../oracle/{ => upgrade}/oracle-upgrade-1.0.3.sql  |    0 
 .../oracle/{ => upgrade}/oracle-upgrade-1.3.0.sql  |    0 
 module/idoutils/db/pgsql/pgsql.sql                 |   15 +++++++--------
 .../db/pgsql/{ => upgrade}/pgsql-upgrade-1.0.1.sql |    0 
 .../db/pgsql/{ => upgrade}/pgsql-upgrade-1.0.3.sql |    0 
 .../db/pgsql/{ => upgrade}/pgsql-upgrade-1.3.0.sql |    0 
 update-version                                     |   11 +++++++++++
 19 files changed, 32 insertions(+), 17 deletions(-)

diff --git a/module/idoutils/db/mysql/mysql.sql b/module/idoutils/db/mysql/mysql.sql
index 0b17a47..95de370 100644
--- a/module/idoutils/db/mysql/mysql.sql
+++ b/module/idoutils/db/mysql/mysql.sql
@@ -1376,11 +1376,6 @@ CREATE TABLE IF NOT EXISTS `icinga_timeperiod_timeranges` (
 
 
 -- -----------------------------------------
--- set dbversion
--- -----------------------------------------
-INSERT INTO icinga_dbversion (name, version) VALUES ('idoutils', '1.3.0') ON DUPLICATE KEY UPDATE version='1.3.0';
-
--- -----------------------------------------
 -- add index (delete)
 -- -----------------------------------------
 
@@ -1556,3 +1551,10 @@ CREATE INDEX loge_inst_id_time_idx on icinga_logentries (instance_id ASC, logent
 
 -- statehistory
 CREATE INDEX statehist_i_id_o_id_s_ty_s_ti on icinga_statehistory(instance_id, object_id, state_type, state_time);
+
+-- -----------------------------------------
+-- set dbversion
+-- -----------------------------------------
+INSERT INTO icinga_dbversion (name, version) VALUES ('idoutils', '1.3.0') ON DUPLICATE KEY UPDATE version='1.3.0';
+
+
diff --git a/module/idoutils/db/mysql/mysql-upgrade-0.8.3.sql b/module/idoutils/db/mysql/upgrade/mysql-upgrade-0.8.3.sql
similarity index 100%
rename from module/idoutils/db/mysql/mysql-upgrade-0.8.3.sql
rename to module/idoutils/db/mysql/upgrade/mysql-upgrade-0.8.3.sql
diff --git a/module/idoutils/db/mysql/mysql-upgrade-1.0.1.sql b/module/idoutils/db/mysql/upgrade/mysql-upgrade-1.0.1.sql
similarity index 100%
rename from module/idoutils/db/mysql/mysql-upgrade-1.0.1.sql
rename to module/idoutils/db/mysql/upgrade/mysql-upgrade-1.0.1.sql
diff --git a/module/idoutils/db/mysql/mysql-upgrade-1.0.2-fix-object-relations.sql b/module/idoutils/db/mysql/upgrade/mysql-upgrade-1.0.2-fix-object-relations.sql
similarity index 100%
rename from module/idoutils/db/mysql/mysql-upgrade-1.0.2-fix-object-relations.sql
rename to module/idoutils/db/mysql/upgrade/mysql-upgrade-1.0.2-fix-object-relations.sql
diff --git a/module/idoutils/db/mysql/mysql-upgrade-1.0.2.sql b/module/idoutils/db/mysql/upgrade/mysql-upgrade-1.0.2.sql
similarity index 100%
rename from module/idoutils/db/mysql/mysql-upgrade-1.0.2.sql
rename to module/idoutils/db/mysql/upgrade/mysql-upgrade-1.0.2.sql
diff --git a/module/idoutils/db/mysql/mysql-upgrade-1.0.3.sql b/module/idoutils/db/mysql/upgrade/mysql-upgrade-1.0.3.sql
similarity index 100%
rename from module/idoutils/db/mysql/mysql-upgrade-1.0.3.sql
rename to module/idoutils/db/mysql/upgrade/mysql-upgrade-1.0.3.sql
diff --git a/module/idoutils/db/mysql/mysql-upgrade-1.0.sql b/module/idoutils/db/mysql/upgrade/mysql-upgrade-1.0.sql
similarity index 100%
rename from module/idoutils/db/mysql/mysql-upgrade-1.0.sql
rename to module/idoutils/db/mysql/upgrade/mysql-upgrade-1.0.sql
diff --git a/module/idoutils/db/mysql/mysql-upgrade-1.0rc.sql b/module/idoutils/db/mysql/upgrade/mysql-upgrade-1.0rc.sql
similarity index 100%
rename from module/idoutils/db/mysql/mysql-upgrade-1.0rc.sql
rename to module/idoutils/db/mysql/upgrade/mysql-upgrade-1.0rc.sql
diff --git a/module/idoutils/db/mysql/mysql-upgrade-1.3.0.sql b/module/idoutils/db/mysql/upgrade/mysql-upgrade-1.3.0.sql
similarity index 100%
rename from module/idoutils/db/mysql/mysql-upgrade-1.3.0.sql
rename to module/idoutils/db/mysql/upgrade/mysql-upgrade-1.3.0.sql
diff --git a/module/idoutils/db/oracle/oracle.sql b/module/idoutils/db/oracle/oracle.sql
index ea2ece5..eee3323 100644
--- a/module/idoutils/db/oracle/oracle.sql
+++ b/module/idoutils/db/oracle/oracle.sql
@@ -1457,10 +1457,6 @@ CREATE TABLE timeperiods (
   CONSTRAINT timeperiods UNIQUE (instance_id,config_type,timeperiod_object_id)
 );
 
--- -----------------------------------------
--- set dbversion
--- -----------------------------------------
-INSERT INTO dbversion (id, name, version) VALUES ('1', 'idoutils', '1.3.0');
 
 
 -- -----------------------------------------
@@ -1935,3 +1931,10 @@ CREATE SEQUENCE seq_timeperiods
    increment by 1
    nomaxvalue;
 
+
+-- -----------------------------------------
+-- set dbversion
+-- -----------------------------------------
+
+INSERT INTO dbversion (id, name, version) VALUES ('1', 'idoutils', '1.3.0');
+
diff --git a/module/idoutils/db/oracle/oracle-upgrade-1.0.1.sql b/module/idoutils/db/oracle/upgrade/oracle-upgrade-1.0.1.sql
similarity index 100%
rename from module/idoutils/db/oracle/oracle-upgrade-1.0.1.sql
rename to module/idoutils/db/oracle/upgrade/oracle-upgrade-1.0.1.sql
diff --git a/module/idoutils/db/oracle/oracle-upgrade-1.0.2-fix-object-relations.sql b/module/idoutils/db/oracle/upgrade/oracle-upgrade-1.0.2-fix-object-relations.sql
similarity index 100%
rename from module/idoutils/db/oracle/oracle-upgrade-1.0.2-fix-object-relations.sql
rename to module/idoutils/db/oracle/upgrade/oracle-upgrade-1.0.2-fix-object-relations.sql
diff --git a/module/idoutils/db/oracle/oracle-upgrade-1.0.3.sql b/module/idoutils/db/oracle/upgrade/oracle-upgrade-1.0.3.sql
similarity index 100%
rename from module/idoutils/db/oracle/oracle-upgrade-1.0.3.sql
rename to module/idoutils/db/oracle/upgrade/oracle-upgrade-1.0.3.sql
diff --git a/module/idoutils/db/oracle/oracle-upgrade-1.3.0.sql b/module/idoutils/db/oracle/upgrade/oracle-upgrade-1.3.0.sql
similarity index 100%
rename from module/idoutils/db/oracle/oracle-upgrade-1.3.0.sql
rename to module/idoutils/db/oracle/upgrade/oracle-upgrade-1.3.0.sql
diff --git a/module/idoutils/db/pgsql/pgsql.sql b/module/idoutils/db/pgsql/pgsql.sql
index e3aa4f8..286279b 100644
--- a/module/idoutils/db/pgsql/pgsql.sql
+++ b/module/idoutils/db/pgsql/pgsql.sql
@@ -9,8 +9,6 @@
 --
 -- --------------------------------------------------------
 
-CREATE LANGUAGE plpgsql;
-
 --
 -- Functions
 --
@@ -1408,12 +1406,6 @@ CREATE TABLE  icinga_timeperiod_timeranges (
 
 
 -- -----------------------------------------
--- set dbversion
--- -----------------------------------------
-
-SELECT updatedbversion('1.3.0');
-
--- -----------------------------------------
 -- add index (delete)
 -- -----------------------------------------
 
@@ -1591,3 +1583,10 @@ CREATE INDEX loge_inst_id_time_idx on icinga_logentries (instance_id ASC, logent
 -- statehistory
 CREATE INDEX statehist_i_id_o_id_s_ty_s_ti on icinga_statehistory(instance_id, object_id, state_type, state_time);
 
+
+-- -----------------------------------------
+-- set dbversion
+-- -----------------------------------------
+
+SELECT updatedbversion('1.3.0');
+
diff --git a/module/idoutils/db/pgsql/pgsql-upgrade-1.0.1.sql b/module/idoutils/db/pgsql/upgrade/pgsql-upgrade-1.0.1.sql
similarity index 100%
rename from module/idoutils/db/pgsql/pgsql-upgrade-1.0.1.sql
rename to module/idoutils/db/pgsql/upgrade/pgsql-upgrade-1.0.1.sql
diff --git a/module/idoutils/db/pgsql/pgsql-upgrade-1.0.3.sql b/module/idoutils/db/pgsql/upgrade/pgsql-upgrade-1.0.3.sql
similarity index 100%
rename from module/idoutils/db/pgsql/pgsql-upgrade-1.0.3.sql
rename to module/idoutils/db/pgsql/upgrade/pgsql-upgrade-1.0.3.sql
diff --git a/module/idoutils/db/pgsql/pgsql-upgrade-1.3.0.sql b/module/idoutils/db/pgsql/upgrade/pgsql-upgrade-1.3.0.sql
similarity index 100%
rename from module/idoutils/db/pgsql/pgsql-upgrade-1.3.0.sql
rename to module/idoutils/db/pgsql/upgrade/pgsql-upgrade-1.3.0.sql
diff --git a/update-version b/update-version
index b05ea23..4a20a8d 100755
--- a/update-version
+++ b/update-version
@@ -94,3 +94,14 @@ perl -i -p -e "s/FILE2SOCK_DATE \".*\"/FILE2SOCK_DATE \"$SHORTDATE\"/;" module/i
 perl -i -p -e "s/LOG2IDO_VERSION \".*\"/LOG2IDO_VERSION \"$newversion\"/;" module/idoutils/src/log2ido.c
 perl -i -p -e "s/LOG2IDO_DATE \".*\"/LOG2IDO_DATE \"$SHORTDATE\"/;" module/idoutils/src/log2ido.c
 
+# Update dbversion in IDOUtils
+# mysql INSERT INTO icinga_dbversion (name, version) VALUES ('idoutils', '1.3.0') ON DUPLICATE KEY UPDATE version='1.3.0';
+# pgsql SELECT updatedbversion('1.3.0');
+# oracle INSERT INTO dbversion (id, name, version) VALUES ('1', 'idoutils', '1.3.0');
+
+perl -i -p -e "s/VALUES \(\'idoutils\', \'.*\'\)/VALUES \(\'idoutils\', \'$newversion\'\)/;" module/idoutils/db/mysql/mysql.sql
+perl -i -p -e "s/version=\'.*\'/version=\'$newversion\'/;" module/idoutils/db/mysql/mysql.sql
+perl -i -p -e "s/updatedbversion\(\'.*\'\)/updatedbversion\(\'$newversion\'\)/;" module/idoutils/db/pgsql/pgsql.sql
+perl -i -p -e "s/VALUES \(\'1\', \'idoutils\', \'.*\'\)/VALUES \(\'1\', \'idoutils\', \'$newversion\'\)/;" module/idoutils/db/oracle/oracle.sql
+
+





More information about the icinga-checkins mailing list