schema: allow to delete service sets...
...containing services and also hosts using service sets without requiring one to manually remove all assigned sets first fixes #13531
This commit is contained in:
parent
ec0ea2ee6d
commit
d2bd133d51
|
@ -0,0 +1,21 @@
|
|||
ALTER TABLE icinga_service_set
|
||||
DROP FOREIGN KEY icinga_service_set_host;
|
||||
|
||||
ALTER TABLE icinga_service_set
|
||||
ADD FOREIGN KEY icinga_service_set_host (host_id)
|
||||
REFERENCES icinga_host (id)
|
||||
ON DELETE CASCADE
|
||||
ON UPDATE CASCADE;
|
||||
|
||||
ALTER TABLE icinga_service
|
||||
DROP FOREIGN KEY icinga_service_service_set;
|
||||
|
||||
ALTER TABLE icinga_service
|
||||
ADD CONSTRAINT icinga_service_service_set FOREIGN KEY (service_set_id)
|
||||
REFERENCES icinga_service_set (id)
|
||||
ON DELETE CASCADE
|
||||
ON UPDATE CASCADE;
|
||||
|
||||
INSERT INTO director_schema_migration
|
||||
(schema_version, migration_time)
|
||||
VALUES (124, NOW());
|
|
@ -541,7 +541,7 @@ CREATE TABLE icinga_service_set (
|
|||
CONSTRAINT icinga_service_set_host
|
||||
FOREIGN KEY host (host_id)
|
||||
REFERENCES icinga_host (id)
|
||||
ON DELETE RESTRICT
|
||||
ON DELETE CASCADE
|
||||
ON UPDATE CASCADE
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
|
||||
|
||||
|
@ -613,7 +613,7 @@ CREATE TABLE icinga_service (
|
|||
CONSTRAINT icinga_service_service_set
|
||||
FOREIGN KEY service_set (service_set_id)
|
||||
REFERENCES icinga_service_set (id)
|
||||
ON DELETE RESTRICT
|
||||
ON DELETE CASCADE
|
||||
ON UPDATE CASCADE
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
|
||||
|
||||
|
@ -1365,4 +1365,4 @@ CREATE TABLE sync_run (
|
|||
|
||||
INSERT INTO director_schema_migration
|
||||
(schema_version, migration_time)
|
||||
VALUES (123, NOW());
|
||||
VALUES (124, NOW());
|
||||
|
|
|
@ -0,0 +1,21 @@
|
|||
ALTER TABLE icinga_service_set
|
||||
DROP CONSTRAINT icinga_service_set_host;
|
||||
|
||||
ALTER TABLE icinga_service_set
|
||||
ADD CONSTRAINT icinga_service_set_host FOREIGN KEY (host_id)
|
||||
REFERENCES icinga_host (id)
|
||||
ON DELETE CASCADE
|
||||
ON UPDATE CASCADE;
|
||||
|
||||
ALTER TABLE icinga_service
|
||||
DROP CONSTRAINT icinga_service_service_set;
|
||||
|
||||
ALTER TABLE icinga_service
|
||||
ADD CONSTRAINT icinga_service_service_set FOREIGN KEY (service_set_id)
|
||||
REFERENCES icinga_service_set (id)
|
||||
ON DELETE CASCADE
|
||||
ON UPDATE CASCADE;
|
||||
|
||||
INSERT INTO director_schema_migration
|
||||
(schema_version, migration_time)
|
||||
VALUES (124, NOW());
|
|
@ -682,7 +682,7 @@ CREATE TABLE icinga_service_set (
|
|||
CONSTRAINT icinga_service_set_host
|
||||
FOREIGN KEY (host_id)
|
||||
REFERENCES icinga_host (id)
|
||||
ON DELETE RESTRICT
|
||||
ON DELETE CASCADE
|
||||
ON UPDATE CASCADE
|
||||
);
|
||||
|
||||
|
@ -758,7 +758,7 @@ CREATE TABLE icinga_service (
|
|||
CONSTRAINT icinga_service_service_set
|
||||
FOREIGN KEY (service_set_id)
|
||||
REFERENCES icinga_service_set (id)
|
||||
ON DELETE RESTRICT
|
||||
ON DELETE CASCADE
|
||||
ON UPDATE CASCADE
|
||||
);
|
||||
|
||||
|
@ -1593,4 +1593,4 @@ CREATE UNIQUE INDEX notification_inheritance ON icinga_notification_inheritance
|
|||
|
||||
INSERT INTO director_schema_migration
|
||||
(schema_version, migration_time)
|
||||
VALUES (123, NOW());
|
||||
VALUES (124, NOW());
|
||||
|
|
Loading…
Reference in New Issue