mirror of
https://github.com/Icinga/icingaweb2-module-director.git
synced 2025-09-22 17:37:50 +02:00
schema: get rid of service_set_service, introduce
...a service_set_id column directly on the service
This commit is contained in:
parent
f09560a89e
commit
3f7a184d2f
8
schema/mysql-migrations/upgrade_121.sql
Normal file
8
schema/mysql-migrations/upgrade_121.sql
Normal file
@ -0,0 +1,8 @@
|
|||||||
|
ALTER TABLE icinga_service
|
||||||
|
ADD COLUMN service_set_id INT(10) UNSIGNED DEFAULT NULL AFTER host_id;
|
||||||
|
|
||||||
|
DROP TABLE icinga_service_set_service;
|
||||||
|
|
||||||
|
INSERT INTO director_schema_migration
|
||||||
|
(schema_version, migration_time)
|
||||||
|
VALUES (121, NOW());
|
@ -535,6 +535,7 @@ CREATE TABLE icinga_service (
|
|||||||
disabled ENUM('y', 'n') NOT NULL DEFAULT 'n',
|
disabled ENUM('y', 'n') NOT NULL DEFAULT 'n',
|
||||||
display_name VARCHAR(255) DEFAULT NULL,
|
display_name VARCHAR(255) DEFAULT NULL,
|
||||||
host_id INT(10) UNSIGNED DEFAULT NULL,
|
host_id INT(10) UNSIGNED DEFAULT NULL,
|
||||||
|
service_set_id INT(10) UNSIGNED DEFAULT NULL,
|
||||||
check_command_id INT(10) UNSIGNED DEFAULT NULL,
|
check_command_id INT(10) UNSIGNED DEFAULT NULL,
|
||||||
max_check_attempts MEDIUMINT UNSIGNED DEFAULT NULL,
|
max_check_attempts MEDIUMINT UNSIGNED DEFAULT NULL,
|
||||||
check_period_id INT(10) UNSIGNED DEFAULT NULL,
|
check_period_id INT(10) UNSIGNED DEFAULT NULL,
|
||||||
@ -670,22 +671,6 @@ CREATE TABLE icinga_service_set (
|
|||||||
UNIQUE KEY object_key (object_name, host_id)
|
UNIQUE KEY object_key (object_name, host_id)
|
||||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
|
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
|
||||||
|
|
||||||
CREATE TABLE icinga_service_set_service (
|
|
||||||
service_set_id INT(10) UNSIGNED NOT NULL,
|
|
||||||
service_id INT(10) UNSIGNED NOT NULL,
|
|
||||||
PRIMARY KEY (service_set_id, service_id),
|
|
||||||
CONSTRAINT service_set_set
|
|
||||||
FOREIGN KEY service_set (service_set_id)
|
|
||||||
REFERENCES icinga_service_set (id)
|
|
||||||
ON DELETE CASCADE
|
|
||||||
ON UPDATE CASCADE,
|
|
||||||
CONSTRAINT service_set_service
|
|
||||||
FOREIGN KEY service (service_id)
|
|
||||||
REFERENCES icinga_service (id)
|
|
||||||
ON DELETE RESTRICT
|
|
||||||
ON UPDATE CASCADE
|
|
||||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
|
|
||||||
|
|
||||||
CREATE TABLE icinga_service_set_inheritance (
|
CREATE TABLE icinga_service_set_inheritance (
|
||||||
service_set_id INT(10) UNSIGNED NOT NULL,
|
service_set_id INT(10) UNSIGNED NOT NULL,
|
||||||
parent_service_set_id INT(10) UNSIGNED NOT NULL,
|
parent_service_set_id INT(10) UNSIGNED NOT NULL,
|
||||||
@ -1369,4 +1354,4 @@ CREATE TABLE sync_run (
|
|||||||
|
|
||||||
INSERT INTO director_schema_migration
|
INSERT INTO director_schema_migration
|
||||||
(schema_version, migration_time)
|
(schema_version, migration_time)
|
||||||
VALUES (120, NOW());
|
VALUES (121, NOW());
|
||||||
|
8
schema/pgsql-migrations/upgrade_121.sql
Normal file
8
schema/pgsql-migrations/upgrade_121.sql
Normal file
@ -0,0 +1,8 @@
|
|||||||
|
ALTER TABLE icinga_service
|
||||||
|
ADD COLUMN service_set_id integer DEFAULT NULL;
|
||||||
|
|
||||||
|
DROP TABLE icinga_service_set_service;
|
||||||
|
|
||||||
|
INSERT INTO director_schema_migration
|
||||||
|
(schema_version, migration_time)
|
||||||
|
VALUES (121, NOW());
|
@ -677,6 +677,7 @@ CREATE TABLE icinga_service (
|
|||||||
disabled enum_boolean DEFAULT 'n',
|
disabled enum_boolean DEFAULT 'n',
|
||||||
display_name character varying(255) DEFAULT NULL,
|
display_name character varying(255) DEFAULT NULL,
|
||||||
host_id INTEGER DEFAULT NULL,
|
host_id INTEGER DEFAULT NULL,
|
||||||
|
service_set_id integer DEFAULT NULL,
|
||||||
check_command_id integer DEFAULT NULL,
|
check_command_id integer DEFAULT NULL,
|
||||||
max_check_attempts integer DEFAULT NULL,
|
max_check_attempts integer DEFAULT NULL,
|
||||||
check_period_id integer DEFAULT NULL,
|
check_period_id integer DEFAULT NULL,
|
||||||
@ -838,23 +839,6 @@ CREATE TABLE icinga_service_set (
|
|||||||
CREATE UNIQUE INDEX service_set_name ON icinga_service_set (object_name, host_id);
|
CREATE UNIQUE INDEX service_set_name ON icinga_service_set (object_name, host_id);
|
||||||
|
|
||||||
|
|
||||||
CREATE TABLE icinga_service_set_service (
|
|
||||||
service_set_id serial,
|
|
||||||
service_id serial,
|
|
||||||
PRIMARY KEY (service_set_id, service_id),
|
|
||||||
CONSTRAINT icinga_service_set_set
|
|
||||||
FOREIGN KEY (service_set_id)
|
|
||||||
REFERENCES icinga_service_set (id)
|
|
||||||
ON DELETE CASCADE
|
|
||||||
ON UPDATE CASCADE,
|
|
||||||
CONSTRAINT icinga_service_set_service
|
|
||||||
FOREIGN KEY (service_id)
|
|
||||||
REFERENCES icinga_service (id)
|
|
||||||
ON DELETE RESTRICT
|
|
||||||
ON UPDATE CASCADE
|
|
||||||
);
|
|
||||||
|
|
||||||
|
|
||||||
CREATE TABLE icinga_service_set_inheritance (
|
CREATE TABLE icinga_service_set_inheritance (
|
||||||
service_set_id integer NOT NULL,
|
service_set_id integer NOT NULL,
|
||||||
parent_service_set_id integer NOT NULL,
|
parent_service_set_id integer NOT NULL,
|
||||||
@ -1597,4 +1581,4 @@ CREATE UNIQUE INDEX notification_inheritance ON icinga_notification_inheritance
|
|||||||
|
|
||||||
INSERT INTO director_schema_migration
|
INSERT INTO director_schema_migration
|
||||||
(schema_version, migration_time)
|
(schema_version, migration_time)
|
||||||
VALUES (120, NOW());
|
VALUES (121, NOW());
|
||||||
|
Loading…
x
Reference in New Issue
Block a user