[icinga-checkins] icinga.org: icingaweb2-module-director/master: schema/pgsql: allow no null var names

git at icinga.org git at icinga.org
Sat May 21 00:28:54 CEST 2016


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

Author: Thomas Gelf <thomas at gelf.net>
Date:   Fri May 20 23:20:19 2016 +0200

schema/pgsql: allow no null var names

---

 schema/pgsql-migrations/upgrade_92.sql |   27 +++++++++++++++++++++++++++
 schema/pgsql.sql                       |   14 +++++++-------
 2 files changed, 34 insertions(+), 7 deletions(-)

diff --git a/schema/pgsql-migrations/upgrade_92.sql b/schema/pgsql-migrations/upgrade_92.sql
new file mode 100644
index 0000000..670a996
--- /dev/null
+++ b/schema/pgsql-migrations/upgrade_92.sql
@@ -0,0 +1,27 @@
+DELETE FROM director_datalist_entry WHERE entry_name IS NULL;
+ALTER TABLE director_datalist_entry ALTER COLUMN entry_name DROP DEFAULT;
+ALTER TABLE director_datalist_entry ALTER COLUMN entry_name SET NOT NULL;
+
+DELETE FROM icinga_command_var WHERE varname IS NULL;
+ALTER TABLE icinga_command_var ALTER COLUMN varname DROP DEFAULT;
+ALTER TABLE icinga_command_var ALTER COLUMN varname SET NOT NULL;
+
+DELETE FROM icinga_host_var WHERE varname IS NULL;
+ALTER TABLE icinga_host_var ALTER COLUMN varname DROP DEFAULT;
+ALTER TABLE icinga_host_var ALTER COLUMN varname SET NOT NULL;
+
+DELETE FROM icinga_service_var WHERE varname IS NULL;
+ALTER TABLE icinga_service_var ALTER COLUMN varname DROP DEFAULT;
+ALTER TABLE icinga_service_var ALTER COLUMN varname SET NOT NULL;
+
+DELETE FROM icinga_user_var WHERE varname IS NULL;
+ALTER TABLE icinga_user_var ALTER COLUMN varname DROP DEFAULT;
+ALTER TABLE icinga_user_var ALTER COLUMN varname SET NOT NULL;
+
+DELETE FROM icinga_notification_var WHERE varname IS NULL;
+ALTER TABLE icinga_notification_var ALTER COLUMN varname DROP DEFAULT;
+ALTER TABLE icinga_notification_var ALTER COLUMN varname SET NOT NULL;
+
+INSERT INTO director_schema_migration
+  (schema_version, migration_time)
+  VALUES (92, NOW());
diff --git a/schema/pgsql.sql b/schema/pgsql.sql
index d5612ed..dc8c259 100644
--- a/schema/pgsql.sql
+++ b/schema/pgsql.sql
@@ -158,7 +158,7 @@ CREATE UNIQUE INDEX datalist_list_name ON director_datalist (list_name);
 
 CREATE TABLE director_datalist_entry (
   list_id integer NOT NULL,
-  entry_name character varying(255) DEFAULT NULL,
+  entry_name character varying(255) NOT NULL,
   entry_value text DEFAULT NULL,
   format enum_property_format,
   PRIMARY KEY (list_id, entry_name),
@@ -414,7 +414,7 @@ CREATE TABLE icinga_command_field (
 
 CREATE TABLE icinga_command_var (
   command_id integer NOT NULL,
-  varname character varying(255) DEFAULT NULL,
+  varname character varying(255) NOT NULL,
   varvalue text DEFAULT NULL,
   format enum_property_format NOT NULL DEFAULT 'string',
   PRIMARY KEY (command_id, varname),
@@ -609,7 +609,7 @@ COMMENT ON COLUMN icinga_host_field.host_id IS 'Makes only sense for templates';
 
 CREATE TABLE icinga_host_var (
   host_id integer NOT NULL,
-  varname character varying(255) DEFAULT NULL,
+  varname character varying(255) NOT NULL,
   varvalue text DEFAULT NULL,
   format enum_property_format, -- immer string vorerst
   PRIMARY KEY (host_id, varname),
@@ -718,7 +718,7 @@ CREATE INDEX service_inheritance_service_parent ON icinga_service_inheritance (p
 
 CREATE TABLE icinga_service_var (
   service_id integer NOT NULL,
-  varname character varying(255) DEFAULT NULL,
+  varname character varying(255) NOT NULL,
   varvalue text DEFAULT NULL,
   format enum_property_format,
   PRIMARY KEY (service_id, varname),
@@ -1000,7 +1000,7 @@ COMMENT ON COLUMN icinga_user_types_set.merge_behaviour IS 'override: = [], exte
 
 CREATE TABLE icinga_user_var (
   user_id integer NOT NULL,
-  varname character varying(255) DEFAULT NULL,
+  varname character varying(255) NOT NULL,
   varvalue text DEFAULT NULL,
   format enum_property_format NOT NULL DEFAULT 'string',
   PRIMARY KEY (user_id, varname),
@@ -1437,7 +1437,7 @@ COMMENT ON COLUMN icinga_notification_types_set.merge_behaviour IS 'override: =
 
 CREATE TABLE icinga_notification_var (
   notification_id integer NOT NULL,
-  varname VARCHAR(255) DEFAULT NULL,
+  varname VARCHAR(255) NOT NULL,
   varvalue TEXT DEFAULT NULL,
   format enum_property_format,
   PRIMARY KEY (notification_id, varname),
@@ -1473,4 +1473,4 @@ CREATE UNIQUE INDEX notification_inheritance ON icinga_notification_inheritance
 
 INSERT INTO director_schema_migration
   (schema_version, migration_time)
-  VALUES (91, NOW());
+  VALUES (92, NOW());



More information about the icinga-checkins mailing list