Added Schema migrations for the servicegroup resolved cache.

This commit is contained in:
Gregory Hargreaves 2018-10-19 14:30:39 +01:00 committed by Thomas Gelf
parent 4c3c81c275
commit c62d5ef56c
4 changed files with 76 additions and 0 deletions

View File

@ -0,0 +1,19 @@
CREATE TABLE icinga_servicegroup_service_resolved (
servicegroup_id INT(10) UNSIGNED NOT NULL,
service_id INT(10) UNSIGNED NOT NULL,
PRIMARY KEY (servicegroup_id, service_id),
CONSTRAINT icinga_servicegroup_service_resolved_service
FOREIGN KEY service (service_id)
REFERENCES icinga_service (id)
ON DELETE CASCADE
ON UPDATE CASCADE,
CONSTRAINT icinga_servicegroup_service_resolved_servicegroup
FOREIGN KEY servicegroup (servicegroup_id)
REFERENCES icinga_servicegroup (id)
ON DELETE CASCADE
ON UPDATE CASCADE
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
INSERT INTO director_schema_migration
(schema_version, migration_time)
VALUES (155, NOW());

View File

@ -915,6 +915,22 @@ CREATE TABLE icinga_servicegroup_service (
ON UPDATE CASCADE
) ENGINE=InnoDB;
CREATE TABLE icinga_servicegroup_service_resolved (
servicegroup_id INT(10) UNSIGNED NOT NULL,
service_id INT(10) UNSIGNED NOT NULL,
PRIMARY KEY (servicegroup_id, service_id),
CONSTRAINT icinga_servicegroup_service_resolved_service
FOREIGN KEY service (service_id)
REFERENCES icinga_service (id)
ON DELETE CASCADE
ON UPDATE CASCADE,
CONSTRAINT icinga_servicegroup_service_resolved_servicegroup
FOREIGN KEY servicegroup (servicegroup_id)
REFERENCES icinga_servicegroup (id)
ON DELETE CASCADE
ON UPDATE CASCADE
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
CREATE TABLE icinga_hostgroup_host (
hostgroup_id INT(10) UNSIGNED NOT NULL,
host_id INT(10) UNSIGNED NOT NULL,

View File

@ -0,0 +1,22 @@
CREATE TABLE icinga_servicegroup_service_resolved (
servicegroup_id integer NOT NULL,
service_id integer NOT NULL,
PRIMARY KEY (servicegroup_id, service_id),
CONSTRAINT icinga_servicegroup_service_resolved_service
FOREIGN KEY (service_id)
REFERENCES icinga_service (id)
ON DELETE CASCADE
ON UPDATE CASCADE,
CONSTRAINT icinga_servicegroup_service_resolved_servicegroup
FOREIGN KEY (servicegroup_id)
REFERENCES icinga_servicegroup (id)
ON DELETE CASCADE
ON UPDATE CASCADE
);
CREATE INDEX servicegroup_service_resolved_service ON icinga_servicegroup_service_resolved (service_id);
CREATE INDEX servicegroup_service_resolved_servicegroup ON icinga_servicegroup_service_resolved (servicegroup_id);
INSERT INTO director_schema_migration
(schema_version, migration_time)
VALUES (155, NOW());

View File

@ -1080,6 +1080,25 @@ CREATE TABLE icinga_servicegroup (
CREATE UNIQUE INDEX servicegroup_object_name ON icinga_servicegroup (object_name);
CREATE INDEX servicegroup_search_idx ON icinga_servicegroup (display_name);
CREATE TABLE icinga_servicegroup_service_resolved (
servicegroup_id integer NOT NULL,
service_id integer NOT NULL,
PRIMARY KEY (servicegroup_id, service_id),
CONSTRAINT icinga_servicegroup_service_resolved_service
FOREIGN KEY (service_id)
REFERENCES icinga_service (id)
ON DELETE CASCADE
ON UPDATE CASCADE,
CONSTRAINT icinga_servicegroup_service_resolved_servicegroup
FOREIGN KEY (servicegroup_id)
REFERENCES icinga_servicegroup (id)
ON DELETE CASCADE
ON UPDATE CASCADE
);
CREATE INDEX servicegroup_service_resolved_service ON icinga_servicegroup_service_resolved (service_id);
CREATE INDEX servicegroup_service_resolved_servicegroup ON icinga_servicegroup_service_resolved (servicegroup_id);
CREATE TABLE icinga_servicegroup_inheritance (
servicegroup_id integer NOT NULL,