From 247ef41483ca8adc79c9c12a81fc58460b5851af Mon Sep 17 00:00:00 2001 From: Thomas Gelf Date: Sat, 12 Mar 2016 01:56:59 +0100 Subject: [PATCH] schema: add notification assignment tables --- schema/mysql-migrations/upgrade_85.sql | 15 +++++++++++++++ schema/mysql.sql | 14 +++++++++++++- schema/pgsql-migrations/upgrade_85.sql | 15 +++++++++++++++ schema/pgsql.sql | 15 ++++++++++++++- 4 files changed, 57 insertions(+), 2 deletions(-) create mode 100644 schema/mysql-migrations/upgrade_85.sql create mode 100644 schema/pgsql-migrations/upgrade_85.sql diff --git a/schema/mysql-migrations/upgrade_85.sql b/schema/mysql-migrations/upgrade_85.sql new file mode 100644 index 00000000..186e1712 --- /dev/null +++ b/schema/mysql-migrations/upgrade_85.sql @@ -0,0 +1,15 @@ +CREATE TABLE icinga_notification_assignment ( + id INT(10) UNSIGNED NOT NULL AUTO_INCREMENT, + notification_id INT(10) UNSIGNED NOT NULL, + filter_string TEXT NOT NULL, + PRIMARY KEY (id), + CONSTRAINT icinga_notification_assignment + FOREIGN KEY notification (notification_id) + REFERENCES icinga_notification (id) + ON DELETE CASCADE + ON UPDATE CASCADE +) ENGINE=InnoDB; + +INSERT INTO director_schema_migration + (schema_version, migration_time) + VALUES (85, NOW()); diff --git a/schema/mysql.sql b/schema/mysql.sql index a8a81276..43e5f3c3 100644 --- a/schema/mysql.sql +++ b/schema/mysql.sql @@ -1029,6 +1029,18 @@ CREATE TABLE icinga_notification_types_set ( ON UPDATE CASCADE ) ENGINE=InnoDB; +CREATE TABLE icinga_notification_assignment ( + id INT(10) UNSIGNED NOT NULL AUTO_INCREMENT, + notification_id INT(10) UNSIGNED NOT NULL, + filter_string TEXT NOT NULL, + PRIMARY KEY (id), + CONSTRAINT icinga_notification_assignment + FOREIGN KEY notification (notification_id) + REFERENCES icinga_notification (id) + ON DELETE CASCADE + ON UPDATE CASCADE +) ENGINE=InnoDB; + CREATE TABLE import_source ( id INT(10) UNSIGNED AUTO_INCREMENT NOT NULL, source_name VARCHAR(64) NOT NULL, @@ -1213,4 +1225,4 @@ CREATE TABLE sync_run ( INSERT INTO director_schema_migration SET migration_time = NOW(), - schema_version = 84; + schema_version = 85; diff --git a/schema/pgsql-migrations/upgrade_85.sql b/schema/pgsql-migrations/upgrade_85.sql new file mode 100644 index 00000000..6aca7095 --- /dev/null +++ b/schema/pgsql-migrations/upgrade_85.sql @@ -0,0 +1,15 @@ +CREATE TABLE icinga_notification_assignment ( + id bigserial, + notification_id integer NOT NULL, + filter_string TEXT NOT NULL, + PRIMARY KEY (id), + CONSTRAINT icinga_notification_assignment + FOREIGN KEY (notification_id) + REFERENCES icinga_notification (id) + ON DELETE CASCADE + ON UPDATE CASCADE +); + +INSERT INTO director_schema_migration + (schema_version, migration_time) + VALUES (85, NOW()); diff --git a/schema/pgsql.sql b/schema/pgsql.sql index fd3d6c0a..1b215630 100644 --- a/schema/pgsql.sql +++ b/schema/pgsql.sql @@ -1152,6 +1152,19 @@ CREATE TABLE icinga_notification ( ); +CREATE TABLE icinga_notification_assignment ( + id bigserial, + notification_id integer NOT NULL, + filter_string TEXT NOT NULL, + PRIMARY KEY (id), + CONSTRAINT icinga_notification_assignment + FOREIGN KEY (notification_id) + REFERENCES icinga_notification (id) + ON DELETE CASCADE + ON UPDATE CASCADE +); + + CREATE TABLE import_source ( id serial, source_name character varying(64) NOT NULL, @@ -1424,4 +1437,4 @@ CREATE UNIQUE INDEX notification_inheritance ON icinga_notification_inheritance -- set current schema version INSERT INTO director_schema_migration (schema_version, migration_time) - VALUES (84, NOW()); + VALUES (85, NOW());