[icinga-checkins] icinga.org: icingaweb2-module-director/master: schema: command argument_name should not be null

git at icinga.org git at icinga.org
Fri Aug 26 09:04:33 CEST 2016


Module: icingaweb2-module-director
Branch: master
Commit: fbf4400ad2bc534748c419eeb198f3867730387d
URL:    https://git.icinga.org/?p=icingaweb2-module-director.git;a=commit;h=fbf4400ad2bc534748c419eeb198f3867730387d

Author: Thomas Gelf <thomas at gelf.net>
Date:   Fri Aug 26 07:02:15 2016 +0000

schema: command argument_name should not be null

fixes #11554
fixes #11918

---

 schema/mysql-migrations/upgrade_103.sql |   12 ++++++++++++
 schema/mysql.sql                        |    4 ++--
 schema/pgsql-migrations/upgrade_103.sql |   11 +++++++++++
 schema/pgsql.sql                        |    4 ++--
 4 files changed, 27 insertions(+), 4 deletions(-)

diff --git a/schema/mysql-migrations/upgrade_103.sql b/schema/mysql-migrations/upgrade_103.sql
new file mode 100644
index 0000000..64d222b
--- /dev/null
+++ b/schema/mysql-migrations/upgrade_103.sql
@@ -0,0 +1,12 @@
+UPDATE icinga_command_argument
+  SET
+    argument_name = '(no key)',
+    skip_key = 'y'
+  WHERE argument_name IS NULL;
+
+ALTER TABLE icinga_command_argument
+  MODIFY argument_name VARCHAR(64) COLLATE utf8_bin NOT NULL COMMENT '-x, --host';
+
+INSERT INTO director_schema_migration
+  (schema_version, migration_time)
+  VALUES (103, NOW());
diff --git a/schema/mysql.sql b/schema/mysql.sql
index c8427da..5239f11 100644
--- a/schema/mysql.sql
+++ b/schema/mysql.sql
@@ -311,7 +311,7 @@ CREATE TABLE icinga_command_inheritance (
 CREATE TABLE icinga_command_argument (
   id INT(10) UNSIGNED AUTO_INCREMENT NOT NULL,
   command_id INT(10) UNSIGNED NOT NULL,
-  argument_name VARCHAR(64) COLLATE utf8_bin DEFAULT NULL COMMENT '-x, --host',
+  argument_name VARCHAR(64) COLLATE utf8_bin NOT NULL COMMENT '-x, --host',
   argument_value TEXT DEFAULT NULL,
   argument_format ENUM('string', 'expression', 'json') NULL DEFAULT NULL,
   key_string VARCHAR(64) DEFAULT NULL COMMENT 'Overrides name',
@@ -1312,4 +1312,4 @@ CREATE TABLE sync_run (
 
 INSERT INTO director_schema_migration
   SET migration_time = NOW(),
-      schema_version = 102;
+      schema_version = 103;
diff --git a/schema/pgsql-migrations/upgrade_103.sql b/schema/pgsql-migrations/upgrade_103.sql
new file mode 100644
index 0000000..ac001bf
--- /dev/null
+++ b/schema/pgsql-migrations/upgrade_103.sql
@@ -0,0 +1,11 @@
+UPDATE icinga_command_argument
+  SET
+    argument_name = '(no key)',
+    skip_key = 'y'
+  WHERE argument_name is null;
+
+ALTER TABLE icinga_command_argument ALTER COLUMN argument_name SET NOT NULL;
+
+INSERT INTO director_schema_migration
+  (schema_version, migration_time)
+  VALUES (103, NOW());
diff --git a/schema/pgsql.sql b/schema/pgsql.sql
index 41ff5fc..08ee0cf 100644
--- a/schema/pgsql.sql
+++ b/schema/pgsql.sql
@@ -416,7 +416,7 @@ CREATE INDEX command_inheritance_command_parent ON icinga_command_inheritance (p
 CREATE TABLE icinga_command_argument (
   id serial,
   command_id integer NOT NULL,
-  argument_name character varying(64) DEFAULT NULL,
+  argument_name character varying(64) NOT NULL,
   argument_value text DEFAULT NULL,
   argument_format enum_property_format DEFAULT NULL,
   key_string character varying(64) DEFAULT NULL,
@@ -1532,4 +1532,4 @@ CREATE UNIQUE INDEX notification_inheritance ON icinga_notification_inheritance
 
 INSERT INTO director_schema_migration
   (schema_version, migration_time)
-  VALUES (102, NOW());
+  VALUES (103, NOW());



More information about the icinga-checkins mailing list