mirror of
https://github.com/Icinga/icingaweb2-module-director.git
synced 2025-07-31 01:34:12 +02:00
schema: add tables for notification user(group)s
This commit is contained in:
parent
5e80516f6d
commit
a3c089e6c6
35
schema/mysql-migrations/upgrade_86.sql
Normal file
35
schema/mysql-migrations/upgrade_86.sql
Normal file
@ -0,0 +1,35 @@
|
|||||||
|
CREATE TABLE icinga_notification_user (
|
||||||
|
notification_id INT(10) UNSIGNED NOT NULL,
|
||||||
|
user_id INT(10) UNSIGNED NOT NULL,
|
||||||
|
PRIMARY KEY (notification_id, user_id),
|
||||||
|
CONSTRAINT icinga_notification_user_user
|
||||||
|
FOREIGN KEY user (user_id)
|
||||||
|
REFERENCES icinga_user (id)
|
||||||
|
ON DELETE CASCADE
|
||||||
|
ON UPDATE CASCADE,
|
||||||
|
CONSTRAINT icinga_notification_user_notification
|
||||||
|
FOREIGN KEY notification (notification_id)
|
||||||
|
REFERENCES icinga_notification (id)
|
||||||
|
ON DELETE CASCADE
|
||||||
|
ON UPDATE CASCADE
|
||||||
|
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
|
||||||
|
|
||||||
|
CREATE TABLE icinga_notification_usergroup (
|
||||||
|
notification_id INT(10) UNSIGNED NOT NULL,
|
||||||
|
usergroup_id INT(10) UNSIGNED NOT NULL,
|
||||||
|
PRIMARY KEY (notification_id, usergroup_id),
|
||||||
|
CONSTRAINT icinga_notification_usergroup_usergroup
|
||||||
|
FOREIGN KEY usergroup (usergroup_id)
|
||||||
|
REFERENCES icinga_usergroup (id)
|
||||||
|
ON DELETE CASCADE
|
||||||
|
ON UPDATE CASCADE,
|
||||||
|
CONSTRAINT icinga_notification_usergroup_notification
|
||||||
|
FOREIGN KEY notification (notification_id)
|
||||||
|
REFERENCES icinga_notification (id)
|
||||||
|
ON DELETE CASCADE
|
||||||
|
ON UPDATE CASCADE
|
||||||
|
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
|
||||||
|
|
||||||
|
INSERT INTO director_schema_migration
|
||||||
|
(schema_version, migration_time)
|
||||||
|
VALUES (86, NOW());
|
@ -1041,6 +1041,38 @@ CREATE TABLE icinga_notification_assignment (
|
|||||||
ON UPDATE CASCADE
|
ON UPDATE CASCADE
|
||||||
) ENGINE=InnoDB;
|
) ENGINE=InnoDB;
|
||||||
|
|
||||||
|
CREATE TABLE icinga_notification_user (
|
||||||
|
notification_id INT(10) UNSIGNED NOT NULL,
|
||||||
|
user_id INT(10) UNSIGNED NOT NULL,
|
||||||
|
PRIMARY KEY (notification_id, user_id),
|
||||||
|
CONSTRAINT icinga_notification_user_user
|
||||||
|
FOREIGN KEY user (user_id)
|
||||||
|
REFERENCES icinga_user (id)
|
||||||
|
ON DELETE CASCADE
|
||||||
|
ON UPDATE CASCADE,
|
||||||
|
CONSTRAINT icinga_notification_user_notification
|
||||||
|
FOREIGN KEY notification (notification_id)
|
||||||
|
REFERENCES icinga_notification (id)
|
||||||
|
ON DELETE CASCADE
|
||||||
|
ON UPDATE CASCADE
|
||||||
|
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
|
||||||
|
|
||||||
|
CREATE TABLE icinga_notification_usergroup (
|
||||||
|
notification_id INT(10) UNSIGNED NOT NULL,
|
||||||
|
usergroup_id INT(10) UNSIGNED NOT NULL,
|
||||||
|
PRIMARY KEY (notification_id, usergroup_id),
|
||||||
|
CONSTRAINT icinga_notification_usergroup_usergroup
|
||||||
|
FOREIGN KEY usergroup (usergroup_id)
|
||||||
|
REFERENCES icinga_usergroup (id)
|
||||||
|
ON DELETE CASCADE
|
||||||
|
ON UPDATE CASCADE,
|
||||||
|
CONSTRAINT icinga_notification_usergroup_notification
|
||||||
|
FOREIGN KEY notification (notification_id)
|
||||||
|
REFERENCES icinga_notification (id)
|
||||||
|
ON DELETE CASCADE
|
||||||
|
ON UPDATE CASCADE
|
||||||
|
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
|
||||||
|
|
||||||
CREATE TABLE import_source (
|
CREATE TABLE import_source (
|
||||||
id INT(10) UNSIGNED AUTO_INCREMENT NOT NULL,
|
id INT(10) UNSIGNED AUTO_INCREMENT NOT NULL,
|
||||||
source_name VARCHAR(64) NOT NULL,
|
source_name VARCHAR(64) NOT NULL,
|
||||||
@ -1225,4 +1257,4 @@ CREATE TABLE sync_run (
|
|||||||
|
|
||||||
INSERT INTO director_schema_migration
|
INSERT INTO director_schema_migration
|
||||||
SET migration_time = NOW(),
|
SET migration_time = NOW(),
|
||||||
schema_version = 85;
|
schema_version = 86;
|
||||||
|
35
schema/pgsql-migrations/upgrade_86.sql
Normal file
35
schema/pgsql-migrations/upgrade_86.sql
Normal file
@ -0,0 +1,35 @@
|
|||||||
|
CREATE TABLE icinga_notification_user (
|
||||||
|
notification_id integer NOT NULL,
|
||||||
|
user_id integer NOT NULL,
|
||||||
|
PRIMARY KEY (notification_id, user_id),
|
||||||
|
CONSTRAINT icinga_notification_user_user
|
||||||
|
FOREIGN KEY (user_id)
|
||||||
|
REFERENCES icinga_user (id)
|
||||||
|
ON DELETE CASCADE
|
||||||
|
ON UPDATE CASCADE,
|
||||||
|
CONSTRAINT icinga_notification_user_notification
|
||||||
|
FOREIGN KEY (notification_id)
|
||||||
|
REFERENCES icinga_notification (id)
|
||||||
|
ON DELETE CASCADE
|
||||||
|
ON UPDATE CASCADE
|
||||||
|
);
|
||||||
|
|
||||||
|
CREATE TABLE icinga_notification_usergroup (
|
||||||
|
notification_id integer NOT NULL,
|
||||||
|
usergroup_id integer NOT NULL,
|
||||||
|
PRIMARY KEY (notification_id, usergroup_id),
|
||||||
|
CONSTRAINT icinga_notification_usergroup_usergroup
|
||||||
|
FOREIGN KEY (usergroup_id)
|
||||||
|
REFERENCES icinga_usergroup (id)
|
||||||
|
ON DELETE CASCADE
|
||||||
|
ON UPDATE CASCADE,
|
||||||
|
CONSTRAINT icinga_notification_usergroup_notification
|
||||||
|
FOREIGN KEY (notification_id)
|
||||||
|
REFERENCES icinga_notification (id)
|
||||||
|
ON DELETE CASCADE
|
||||||
|
ON UPDATE CASCADE
|
||||||
|
);
|
||||||
|
|
||||||
|
INSERT INTO director_schema_migration
|
||||||
|
(schema_version, migration_time)
|
||||||
|
VALUES (86, NOW());
|
@ -1165,6 +1165,39 @@ CREATE TABLE icinga_notification_assignment (
|
|||||||
);
|
);
|
||||||
|
|
||||||
|
|
||||||
|
CREATE TABLE icinga_notification_user (
|
||||||
|
notification_id integer NOT NULL,
|
||||||
|
user_id integer NOT NULL,
|
||||||
|
PRIMARY KEY (notification_id, user_id),
|
||||||
|
CONSTRAINT icinga_notification_user_user
|
||||||
|
FOREIGN KEY (user_id)
|
||||||
|
REFERENCES icinga_user (id)
|
||||||
|
ON DELETE CASCADE
|
||||||
|
ON UPDATE CASCADE,
|
||||||
|
CONSTRAINT icinga_notification_user_notification
|
||||||
|
FOREIGN KEY (notification_id)
|
||||||
|
REFERENCES icinga_notification (id)
|
||||||
|
ON DELETE CASCADE
|
||||||
|
ON UPDATE CASCADE
|
||||||
|
);
|
||||||
|
|
||||||
|
CREATE TABLE icinga_notification_usergroup (
|
||||||
|
notification_id integer NOT NULL,
|
||||||
|
usergroup_id integer NOT NULL,
|
||||||
|
PRIMARY KEY (notification_id, usergroup_id),
|
||||||
|
CONSTRAINT icinga_notification_usergroup_usergroup
|
||||||
|
FOREIGN KEY (usergroup_id)
|
||||||
|
REFERENCES icinga_usergroup (id)
|
||||||
|
ON DELETE CASCADE
|
||||||
|
ON UPDATE CASCADE,
|
||||||
|
CONSTRAINT icinga_notification_usergroup_notification
|
||||||
|
FOREIGN KEY (notification_id)
|
||||||
|
REFERENCES icinga_notification (id)
|
||||||
|
ON DELETE CASCADE
|
||||||
|
ON UPDATE CASCADE
|
||||||
|
);
|
||||||
|
|
||||||
|
|
||||||
CREATE TABLE import_source (
|
CREATE TABLE import_source (
|
||||||
id serial,
|
id serial,
|
||||||
source_name character varying(64) NOT NULL,
|
source_name character varying(64) NOT NULL,
|
||||||
@ -1437,4 +1470,4 @@ CREATE UNIQUE INDEX notification_inheritance ON icinga_notification_inheritance
|
|||||||
-- set current schema version
|
-- set current schema version
|
||||||
INSERT INTO director_schema_migration
|
INSERT INTO director_schema_migration
|
||||||
(schema_version, migration_time)
|
(schema_version, migration_time)
|
||||||
VALUES (85, NOW());
|
VALUES (86, NOW());
|
||||||
|
Loading…
x
Reference in New Issue
Block a user