mirror of
https://github.com/Icinga/icingaweb2-module-director.git
synced 2025-07-26 23:34:10 +02:00
schema/mysql: delete services on host deletion
We would otherwise create host-less service-aliens
This commit is contained in:
parent
5427df52e8
commit
83d2047a23
14
schema/mysql-migrations/upgrade_74.sql
Normal file
14
schema/mysql-migrations/upgrade_74.sql
Normal file
@ -0,0 +1,14 @@
|
|||||||
|
|
||||||
|
ALTER TABLE icinga_service
|
||||||
|
DROP FOREIGN KEY icinga_host;
|
||||||
|
|
||||||
|
ALTER TABLE icinga_service
|
||||||
|
ADD CONSTRAINT icinga_service_host
|
||||||
|
FOREIGN KEY host (host_id)
|
||||||
|
REFERENCES icinga_host (id)
|
||||||
|
ON DELETE CASCADE
|
||||||
|
ON UPDATE CASCADE;
|
||||||
|
|
||||||
|
INSERT INTO director_schema_migration
|
||||||
|
SET migration_time = NOW(),
|
||||||
|
schema_version = 74;
|
@ -525,10 +525,10 @@ CREATE TABLE icinga_service (
|
|||||||
PRIMARY KEY (id),
|
PRIMARY KEY (id),
|
||||||
-- UNIQUE INDEX object_name (object_name, zone_id),
|
-- UNIQUE INDEX object_name (object_name, zone_id),
|
||||||
UNIQUE KEY object_key (object_name, host_id),
|
UNIQUE KEY object_key (object_name, host_id),
|
||||||
CONSTRAINT icinga_host
|
CONSTRAINT icinga_service_host
|
||||||
FOREIGN KEY host (host_id)
|
FOREIGN KEY host (host_id)
|
||||||
REFERENCES icinga_host (id)
|
REFERENCES icinga_host (id)
|
||||||
ON DELETE SET NULL
|
ON DELETE CASCADE
|
||||||
ON UPDATE CASCADE,
|
ON UPDATE CASCADE,
|
||||||
CONSTRAINT icinga_service_zone
|
CONSTRAINT icinga_service_zone
|
||||||
FOREIGN KEY zone (zone_id)
|
FOREIGN KEY zone (zone_id)
|
||||||
@ -1112,4 +1112,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 = 73;
|
schema_version = 74;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user