[icinga-checkins] icinga.org: icingaweb2-module-director/master: schema/mysql: add new user event filter tables

git at icinga.org git at icinga.org
Mon Feb 29 20:39:04 CET 2016


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

Author: Thomas Gelf <thomas at gelf.net>
Date:   Mon Feb 29 15:35:11 2016 +0100

schema/mysql: add new user event filter tables

---

 schema/mysql-migrations/upgrade_73.sql |   50 ++++++++++++++++++++++++++++++++
 schema/mysql.sql                       |   26 ++++++++---------
 2 files changed, 63 insertions(+), 13 deletions(-)

diff --git a/schema/mysql-migrations/upgrade_73.sql b/schema/mysql-migrations/upgrade_73.sql
new file mode 100644
index 0000000..ecf27ae
--- /dev/null
+++ b/schema/mysql-migrations/upgrade_73.sql
@@ -0,0 +1,50 @@
+DROP TABLE icinga_user_filter_state;
+
+CREATE TABLE icinga_user_states_set (
+  user_id INT(10) UNSIGNED NOT NULL,
+  property ENUM(
+    'OK',
+    'Warning',
+    'Critical',
+    'Unknown',
+    'Up',
+    'Down'
+  ) NOT NULL,
+  merge_behaviour ENUM('override', 'extend', 'blacklist') NOT NULL DEFAULT 'override'
+    COMMENT 'override: = [], extend: += [], blacklist: -= []',
+  PRIMARY KEY (user_id, property),
+  CONSTRAINT icinga_user_states_set_user
+    FOREIGN KEY icinga_user (user_id)
+    REFERENCES icinga_user (id)
+    ON DELETE CASCADE
+    ON UPDATE CASCADE
+)  ENGINE=InnoDB;
+
+DROP TABLE icinga_user_filter_type;
+
+CREATE TABLE icinga_user_filters_set (
+  user_id INT(10) UNSIGNED NOT NULL,
+  property ENUM(
+    'DowntimeStart',
+    'DowntimeEnd',
+    'DowntimeRemoved',
+    'Custom',
+    'Acknowledgement',
+    'Problem',
+    'Recovery',
+    'FlappingStart',
+    'FlappingEnd'
+  ) NOT NULL,
+  merge_behaviour ENUM('override', 'extend', 'blacklist') NOT NULL DEFAULT 'override'
+    COMMENT 'override: = [], extend: += [], blacklist: -= []',
+  PRIMARY KEY (user_id, property),
+  CONSTRAINT icinga_user_filters_set_user
+    FOREIGN KEY icinga_user (user_id)
+    REFERENCES icinga_user (id)
+    ON DELETE CASCADE
+    ON UPDATE CASCADE
+) ENGINE=InnoDB;
+
+INSERT INTO director_schema_migration
+  SET migration_time = NOW(),
+      schema_version = 73;
diff --git a/schema/mysql.sql b/schema/mysql.sql
index b370b07..b08a398 100644
--- a/schema/mysql.sql
+++ b/schema/mysql.sql
@@ -779,9 +779,9 @@ CREATE TABLE icinga_user_inheritance (
     ON UPDATE CASCADE
 ) ENGINE=InnoDB DEFAULT CHARSET=utf8;
 
-CREATE TABLE icinga_user_filter_state (
+CREATE TABLE icinga_user_states_set (
   user_id INT(10) UNSIGNED NOT NULL,
-  state_name ENUM(
+  property ENUM(
     'OK',
     'Warning',
     'Critical',
@@ -789,19 +789,19 @@ CREATE TABLE icinga_user_filter_state (
     'Up',
     'Down'
   ) NOT NULL,
-  merge_behaviour ENUM('set', 'add', 'substract') NOT NULL DEFAULT 'set'
-    COMMENT 'set: = [], add: += [], substract: -= []',
-  PRIMARY KEY (user_id, state_name),
-  CONSTRAINT icinga_user_filter_state_user
+  merge_behaviour ENUM('override', 'extend', 'blacklist') NOT NULL DEFAULT 'override'
+    COMMENT 'override: = [], extend: += [], blacklist: -= []',
+  PRIMARY KEY (user_id, property),
+  CONSTRAINT icinga_user_states_set_user
     FOREIGN KEY icinga_user (user_id)
     REFERENCES icinga_user (id)
     ON DELETE CASCADE
     ON UPDATE CASCADE
 )  ENGINE=InnoDB;
 
-CREATE TABLE icinga_user_filter_type (
+CREATE TABLE icinga_user_filters_set (
   user_id INT(10) UNSIGNED NOT NULL,
-  type_name ENUM(
+  property ENUM(
     'DowntimeStart',
     'DowntimeEnd',
     'DowntimeRemoved',
@@ -812,10 +812,10 @@ CREATE TABLE icinga_user_filter_type (
     'FlappingStart',
     'FlappingEnd'
   ) NOT NULL,
-  merge_behaviour ENUM('set', 'add', 'substract') NOT NULL DEFAULT 'set'
-    COMMENT 'set: = [], add: += [], substract: -= []',
-  PRIMARY KEY (user_id, type_name),
-  CONSTRAINT icinga_user_filter_type_user
+  merge_behaviour ENUM('override', 'extend', 'blacklist') NOT NULL DEFAULT 'override'
+    COMMENT 'override: = [], extend: += [], blacklist: -= []',
+  PRIMARY KEY (user_id, property),
+  CONSTRAINT icinga_user_filters_set_user
     FOREIGN KEY icinga_user (user_id)
     REFERENCES icinga_user (id)
     ON DELETE CASCADE
@@ -1112,4 +1112,4 @@ CREATE TABLE sync_run (
 
 INSERT INTO director_schema_migration
   SET migration_time = NOW(),
-      schema_version = 72;
+      schema_version = 73;



More information about the icinga-checkins mailing list