mirror of
https://github.com/Icinga/icingaweb2-module-director.git
synced 2025-07-31 01:34:12 +02:00
schema: add icinga_service_set_inheritance...
...and fix NULL constraints
This commit is contained in:
parent
f2f04c44e8
commit
63fca7143c
23
schema/mysql-migrations/upgrade_115.sql
Normal file
23
schema/mysql-migrations/upgrade_115.sql
Normal file
@ -0,0 +1,23 @@
|
||||
CREATE TABLE icinga_service_set_inheritance (
|
||||
service_set_id INT(10) UNSIGNED NOT NULL,
|
||||
parent_service_set_id INT(10) UNSIGNED NOT NULL,
|
||||
weight MEDIUMINT UNSIGNED DEFAULT NULL,
|
||||
PRIMARY KEY (service_set_id, parent_service_set_id),
|
||||
UNIQUE KEY unique_order (service_set_id, weight),
|
||||
CONSTRAINT icinga_service_set_inheritance_set
|
||||
FOREIGN KEY host (service_set_id)
|
||||
REFERENCES icinga_service_set (id)
|
||||
ON DELETE CASCADE
|
||||
ON UPDATE CASCADE,
|
||||
CONSTRAINT icinga_service_set_inheritance_parent
|
||||
FOREIGN KEY host (parent_service_set_id)
|
||||
REFERENCES icinga_service_set (id)
|
||||
ON DELETE RESTRICT
|
||||
ON UPDATE CASCADE
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
|
||||
|
||||
ALTER TABLE icinga_service_set MODIFY description TEXT DEFAULT NULL;
|
||||
|
||||
INSERT INTO director_schema_migration
|
||||
(schema_version, migration_time)
|
||||
VALUES (115, NOW());
|
@ -675,7 +675,7 @@ CREATE TABLE icinga_service_set (
|
||||
object_name VARCHAR(128) NOT NULL,
|
||||
object_type ENUM('object', 'template', 'external_object') NOT NULL,
|
||||
host_id INT(10) UNSIGNED DEFAULT NULL,
|
||||
description TEXT NOT NULL,
|
||||
description TEXT DEFAULT NULL,
|
||||
PRIMARY KEY (id),
|
||||
UNIQUE KEY object_key (object_name, host_id)
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
|
||||
@ -696,6 +696,24 @@ CREATE TABLE icinga_service_set_service (
|
||||
ON UPDATE CASCADE
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
|
||||
|
||||
CREATE TABLE icinga_service_set_inheritance (
|
||||
service_set_id INT(10) UNSIGNED NOT NULL,
|
||||
parent_service_set_id INT(10) UNSIGNED NOT NULL,
|
||||
weight MEDIUMINT UNSIGNED DEFAULT NULL,
|
||||
PRIMARY KEY (service_set_id, parent_service_set_id),
|
||||
UNIQUE KEY unique_order (service_set_id, weight),
|
||||
CONSTRAINT icinga_service_set_inheritance_set
|
||||
FOREIGN KEY host (service_set_id)
|
||||
REFERENCES icinga_service_set (id)
|
||||
ON DELETE CASCADE
|
||||
ON UPDATE CASCADE,
|
||||
CONSTRAINT icinga_service_set_inheritance_parent
|
||||
FOREIGN KEY host (parent_service_set_id)
|
||||
REFERENCES icinga_service_set (id)
|
||||
ON DELETE RESTRICT
|
||||
ON UPDATE CASCADE
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
|
||||
|
||||
CREATE TABLE icinga_service_set_assignment (
|
||||
id INT(10) UNSIGNED NOT NULL AUTO_INCREMENT,
|
||||
service_set_id INT(10) UNSIGNED NOT NULL,
|
||||
@ -1378,4 +1396,4 @@ CREATE TABLE sync_run (
|
||||
|
||||
INSERT INTO director_schema_migration
|
||||
SET migration_time = NOW(),
|
||||
schema_version = 114;
|
||||
schema_version = 115;
|
||||
|
28
schema/pgsql-migrations/upgrade_115.sql
Normal file
28
schema/pgsql-migrations/upgrade_115.sql
Normal file
@ -0,0 +1,28 @@
|
||||
CREATE TABLE icinga_service_set_inheritance (
|
||||
service_set_id integer NOT NULL,
|
||||
parent_service_set_id integer NOT NULL,
|
||||
weight integer DEFAULT NULL,
|
||||
PRIMARY KEY (service_set_id, parent_service_set_id),
|
||||
CONSTRAINT icinga_service_set_inheritance_set
|
||||
FOREIGN KEY (service_set_id)
|
||||
REFERENCES icinga_service_set (id)
|
||||
ON DELETE CASCADE
|
||||
ON UPDATE CASCADE,
|
||||
CONSTRAINT icinga_service_set_inheritance_parent
|
||||
FOREIGN KEY (parent_service_set_id)
|
||||
REFERENCES icinga_service_set (id)
|
||||
ON DELETE RESTRICT
|
||||
ON UPDATE CASCADE
|
||||
);
|
||||
|
||||
CREATE UNIQUE INDEX service_set_inheritance_unique_order ON icinga_service_set_inheritance (service_set_id, weight);
|
||||
CREATE INDEX service_set_inheritance_set ON icinga_service_set_inheritance (service_set_id);
|
||||
CREATE INDEX service_set_inheritance_parent ON icinga_service_set_inheritance (parent_service_set_id);
|
||||
|
||||
|
||||
ALTER TABLE icinga_service_set ALTER COLUMN host_id DROP NOT NULL;
|
||||
ALTER TABLE icinga_service_set ALTER COLUMN description DROP NOT NULL;
|
||||
|
||||
INSERT INTO director_schema_migration
|
||||
(schema_version, migration_time)
|
||||
VALUES (115, NOW());
|
@ -844,10 +844,10 @@ CREATE INDEX host_service_service ON icinga_host_service (service_id);
|
||||
|
||||
CREATE TABLE icinga_service_set (
|
||||
id serial,
|
||||
host_id integer NOT NULL,
|
||||
host_id integer DEFAULT NULL,
|
||||
object_name character varying(128) NOT NULL,
|
||||
object_type enum_object_type_all NOT NULL,
|
||||
description text NOT NULL,
|
||||
description text DEFAULT NULL,
|
||||
PRIMARY KEY (id)
|
||||
);
|
||||
|
||||
@ -871,6 +871,28 @@ CREATE TABLE icinga_service_set_service (
|
||||
);
|
||||
|
||||
|
||||
CREATE TABLE icinga_service_set_inheritance (
|
||||
service_set_id integer NOT NULL,
|
||||
parent_service_set_id integer NOT NULL,
|
||||
weight integer DEFAULT NULL,
|
||||
PRIMARY KEY (service_set_id, parent_service_set_id),
|
||||
CONSTRAINT icinga_service_set_inheritance_set
|
||||
FOREIGN KEY (service_set_id)
|
||||
REFERENCES icinga_service_set (id)
|
||||
ON DELETE CASCADE
|
||||
ON UPDATE CASCADE,
|
||||
CONSTRAINT icinga_service_set_inheritance_parent
|
||||
FOREIGN KEY (parent_service_set_id)
|
||||
REFERENCES icinga_service_set (id)
|
||||
ON DELETE RESTRICT
|
||||
ON UPDATE CASCADE
|
||||
);
|
||||
|
||||
CREATE UNIQUE INDEX service_set_inheritance_unique_order ON icinga_service_set_inheritance (service_set_id, weight);
|
||||
CREATE INDEX service_set_inheritance_set ON icinga_service_set_inheritance (service_set_id);
|
||||
CREATE INDEX service_set_inheritance_parent ON icinga_service_set_inheritance (parent_service_set_id);
|
||||
|
||||
|
||||
CREATE TABLE icinga_service_set_assignment (
|
||||
id serial,
|
||||
service_set_id integer NOT NULL,
|
||||
@ -1605,4 +1627,4 @@ CREATE UNIQUE INDEX notification_inheritance ON icinga_notification_inheritance
|
||||
|
||||
INSERT INTO director_schema_migration
|
||||
(schema_version, migration_time)
|
||||
VALUES (114, NOW());
|
||||
VALUES (115, NOW());
|
||||
|
Loading…
x
Reference in New Issue
Block a user