schema: branched service sets

This commit is contained in:
Thomas Gelf 2022-09-20 14:45:04 +02:00
parent b19dd5f62d
commit 42b06a0b37
4 changed files with 114 additions and 2 deletions

View File

@ -0,0 +1,26 @@
CREATE TABLE branched_icinga_service_set (
uuid VARBINARY(16) NOT NULL,
branch_uuid VARBINARY(16) NOT NULL,
branch_created ENUM('y', 'n') NOT NULL DEFAULT 'n',
branch_deleted ENUM('y', 'n') NOT NULL DEFAULT 'n',
object_name VARCHAR(128) DEFAULT NULL,
object_type ENUM('object', 'template', 'external_object') DEFAULT NULL,
host VARCHAR(255) DEFAULT NULL,
description TEXT DEFAULT NULL,
assign_filter TEXT DEFAULT NULL,
imports TEXT DEFAULT NULL,
set_null TEXT DEFAULT NULL,
PRIMARY KEY (branch_uuid, uuid),
INDEX search_object_name (object_name),
CONSTRAINT icinga_service_set_branch
FOREIGN KEY branch (branch_uuid)
REFERENCES director_branch (uuid)
ON DELETE CASCADE
ON UPDATE CASCADE
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
INSERT INTO director_schema_migration
(schema_version, migration_time)
VALUES (180, NOW());

View File

@ -2309,6 +2309,31 @@ CREATE TABLE branched_icinga_service (
ON UPDATE CASCADE
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
CREATE TABLE branched_icinga_service_set (
uuid VARBINARY(16) NOT NULL,
branch_uuid VARBINARY(16) NOT NULL,
branch_created ENUM('y', 'n') NOT NULL DEFAULT 'n',
branch_deleted ENUM('y', 'n') NOT NULL DEFAULT 'n',
object_name VARCHAR(128) DEFAULT NULL,
object_type ENUM('object', 'template', 'external_object') DEFAULT NULL,
host VARCHAR(255) DEFAULT NULL,
description TEXT DEFAULT NULL,
assign_filter TEXT DEFAULT NULL,
imports TEXT DEFAULT NULL,
imports TEXT DEFAULT NULL,
set_null TEXT DEFAULT NULL,
PRIMARY KEY (branch_uuid, uuid),
INDEX search_object_name (object_name),
CONSTRAINT icinga_service_set_branch
FOREIGN KEY branch (branch_uuid)
REFERENCES director_branch (uuid)
ON DELETE CASCADE
ON UPDATE CASCADE
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
CREATE TABLE branched_icinga_notification (
uuid VARBINARY(16) NOT NULL,
branch_uuid VARBINARY(16) NOT NULL,
@ -2415,4 +2440,4 @@ CREATE TABLE branched_icinga_dependency (
INSERT INTO director_schema_migration
(schema_version, migration_time)
VALUES (179, NOW());
VALUES (180, NOW());

View File

@ -0,0 +1,32 @@
CREATE TABLE branched_icinga_service_set (
uuid bytea NOT NULL UNIQUE CHECK(LENGTH(uuid) = 16),
branch_uuid bytea NOT NULL CHECK(LENGTH(branch_uuid) = 16),
branch_created enum_boolean NOT NULL DEFAULT 'n',
branch_deleted enum_boolean NOT NULL DEFAULT 'n',
object_name character varying(255) DEFAULT NULL,
object_type enum_object_type_all DEFAULT NULL,
disabled enum_boolean DEFAULT NULL,
host character varying(255) DEFAULT NULL,
description TEXT DEFAULT NULL,
assign_filter text DEFAULT NULL,
imports TEXT DEFAULT NULL,
vars TEXT DEFAULT NULL,
set_null TEXT DEFAULT NULL,
PRIMARY KEY (branch_uuid, uuid),
CONSTRAINT icinga_service_branch
FOREIGN KEY (branch_uuid)
REFERENCES director_branch (uuid)
ON DELETE CASCADE
ON UPDATE CASCADE
);
CREATE UNIQUE INDEX service_set_branch_object_name ON branched_icinga_service_set (branch_uuid, object_name);
CREATE INDEX branched_service_set_search_object_name ON branched_icinga_service_set (object_name);
INSERT INTO director_schema_migration
(schema_version, migration_time)
VALUES (180, NOW());

View File

@ -2637,6 +2637,35 @@ CREATE INDEX branched_service_search_object_name ON branched_icinga_service (obj
CREATE INDEX branched_service_search_display_name ON branched_icinga_service (display_name);
CREATE TABLE branched_icinga_service_set (
uuid bytea NOT NULL UNIQUE CHECK(LENGTH(uuid) = 16),
branch_uuid bytea NOT NULL CHECK(LENGTH(branch_uuid) = 16),
branch_created enum_boolean NOT NULL DEFAULT 'n',
branch_deleted enum_boolean NOT NULL DEFAULT 'n',
object_name character varying(255) DEFAULT NULL,
object_type enum_object_type_all DEFAULT NULL,
disabled enum_boolean DEFAULT NULL,
host character varying(255) DEFAULT NULL,
description TEXT DEFAULT NULL,
assign_filter text DEFAULT NULL,
imports TEXT DEFAULT NULL,
vars TEXT DEFAULT NULL,
set_null TEXT DEFAULT NULL,
PRIMARY KEY (branch_uuid, uuid),
CONSTRAINT icinga_service_branch
FOREIGN KEY (branch_uuid)
REFERENCES director_branch (uuid)
ON DELETE CASCADE
ON UPDATE CASCADE
);
CREATE UNIQUE INDEX service_set_branch_object_name ON branched_icinga_service_set (branch_uuid, object_name);
CREATE INDEX branched_service_set_search_object_name ON branched_icinga_service_set (object_name);
CREATE TABLE branched_icinga_notification (
uuid bytea NOT NULL UNIQUE CHECK(LENGTH(uuid) = 16),
branch_uuid bytea NOT NULL CHECK(LENGTH(branch_uuid) = 16),
@ -2749,4 +2778,4 @@ CREATE INDEX branched_dependency_search_object_name ON branched_icinga_dependenc
INSERT INTO director_schema_migration
(schema_version, migration_time)
VALUES (179, NOW());
VALUES (180, NOW());