mirror of
https://github.com/Icinga/icingaweb2-module-director.git
synced 2025-04-08 17:15:10 +02:00
schema, IcingaTemplateChoice: add columns for...
...upcoming features
This commit is contained in:
parent
d132633ff9
commit
cd2ed5cfae
@ -14,6 +14,8 @@ class IcingaTemplateChoice extends IcingaObject
|
||||
'description' => null,
|
||||
'min_required' => 0,
|
||||
'max_allowed' => 1,
|
||||
'required_template_id' => null,
|
||||
'allowed_roles' => null,
|
||||
];
|
||||
|
||||
private $choices;
|
||||
|
@ -7,4 +7,8 @@ class IcingaTemplateChoiceHost extends IcingaTemplateChoice
|
||||
protected $table = 'icinga_host_template_choice';
|
||||
|
||||
protected $objectTable = 'icinga_host';
|
||||
|
||||
protected $relations = array(
|
||||
'required_template' => 'IcingaHost',
|
||||
);
|
||||
}
|
||||
|
@ -7,4 +7,8 @@ class IcingaTemplateChoiceService extends IcingaTemplateChoice
|
||||
protected $table = 'icinga_service_template_choice';
|
||||
|
||||
protected $objectTable = 'icinga_service';
|
||||
|
||||
protected $relations = array(
|
||||
'required_template' => 'IcingaService',
|
||||
);
|
||||
}
|
||||
|
21
schema/mysql-migrations/upgrade_143.sql
Normal file
21
schema/mysql-migrations/upgrade_143.sql
Normal file
@ -0,0 +1,21 @@
|
||||
ALTER TABLE icinga_host_template_choice
|
||||
ADD COLUMN required_template_id INT(10) UNSIGNED DEFAULT NULL,
|
||||
ADD COLUMN allowed_roles VARCHAR(255) DEFAULT NULL,
|
||||
ADD CONSTRAINT host_template_choice_required_template
|
||||
FOREIGN KEY required_template (required_template_id)
|
||||
REFERENCES icinga_host (id)
|
||||
ON DELETE RESTRICT
|
||||
ON UPDATE CASCADE;
|
||||
|
||||
ALTER TABLE icinga_service_template_choice
|
||||
ADD COLUMN required_template_id INT(10) UNSIGNED DEFAULT NULL,
|
||||
ADD COLUMN allowed_roles VARCHAR(255) DEFAULT NULL,
|
||||
ADD CONSTRAINT service_template_choice_required_template
|
||||
FOREIGN KEY required_template (required_template_id)
|
||||
REFERENCES icinga_service (id)
|
||||
ON DELETE RESTRICT
|
||||
ON UPDATE CASCADE;
|
||||
|
||||
INSERT INTO director_schema_migration
|
||||
(schema_version, migration_time)
|
||||
VALUES (143, NOW());
|
@ -428,6 +428,13 @@ CREATE TABLE icinga_host_template_choice (
|
||||
description TEXT DEFAULT NULL,
|
||||
min_required SMALLINT UNSIGNED NOT NULL DEFAULT 0,
|
||||
max_allowed SMALLINT UNSIGNED NOT NULL DEFAULT 1,
|
||||
required_template_id INT(10) UNSIGNED DEFAULT NULL,
|
||||
allowed_roles VARCHAR(255) DEFAULT NULL,
|
||||
CONSTRAINT host_template_choice_required_template
|
||||
FOREIGN KEY required_template (required_template_id)
|
||||
REFERENCES icinga_host (id)
|
||||
ON DELETE RESTRICT
|
||||
ON UPDATE CASCADE,
|
||||
PRIMARY KEY (id),
|
||||
UNIQUE KEY (object_name)
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
|
||||
@ -577,6 +584,13 @@ CREATE TABLE icinga_service_template_choice (
|
||||
description TEXT DEFAULT NULL,
|
||||
min_required SMALLINT UNSIGNED NOT NULL DEFAULT 0,
|
||||
max_allowed SMALLINT UNSIGNED NOT NULL DEFAULT 1,
|
||||
required_template_id INT(10) UNSIGNED DEFAULT NULL,
|
||||
allowed_roles VARCHAR(255) DEFAULT NULL,
|
||||
CONSTRAINT service_template_choice_required_template
|
||||
FOREIGN KEY required_template (required_template_id)
|
||||
REFERENCES icinga_service (id)
|
||||
ON DELETE RESTRICT
|
||||
ON UPDATE CASCADE,
|
||||
PRIMARY KEY (id),
|
||||
UNIQUE KEY (object_name)
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
|
||||
@ -1563,4 +1577,4 @@ CREATE TABLE icinga_user_resolved_var (
|
||||
|
||||
INSERT INTO director_schema_migration
|
||||
(schema_version, migration_time)
|
||||
VALUES (141, NOW());
|
||||
VALUES (143, NOW());
|
||||
|
27
schema/pgsql-migrations/upgrade_143.sql
Normal file
27
schema/pgsql-migrations/upgrade_143.sql
Normal file
@ -0,0 +1,27 @@
|
||||
ALTER TABLE icinga_host_template_choice
|
||||
ADD COLUMN required_template_id integer DEFAULT NULL,
|
||||
ADD COLUMN allowed_roles character varying(255) DEFAULT NULL,
|
||||
ADD CONSTRAINT host_template_choice_required_template
|
||||
FOREIGN KEY (required_template_id)
|
||||
REFERENCES icinga_host (id)
|
||||
ON DELETE RESTRICT
|
||||
ON UPDATE CASCADE;
|
||||
|
||||
ALTER TABLE icinga_service_template_choice
|
||||
ADD COLUMN required_template_id integer DEFAULT NULL,
|
||||
ADD COLUMN allowed_roles character varying(255) DEFAULT NULL,
|
||||
ADD CONSTRAINT service_template_choice_required_template
|
||||
FOREIGN KEY (required_template_id)
|
||||
REFERENCES icinga_service (id)
|
||||
ON DELETE RESTRICT
|
||||
ON UPDATE CASCADE;
|
||||
|
||||
CREATE INDEX host_template_choice_required_template
|
||||
ON icinga_host_template_choice (required_template_id);
|
||||
|
||||
CREATE INDEX service_template_choice_required_template
|
||||
ON icinga_service_template_choice (required_template_id);
|
||||
|
||||
INSERT INTO director_schema_migration
|
||||
(schema_version, migration_time)
|
||||
VALUES (143, NOW());
|
@ -551,10 +551,18 @@ CREATE TABLE icinga_host_template_choice (
|
||||
description text DEFAULT NULL,
|
||||
min_required smallint NOT NULL DEFAULT 0,
|
||||
max_allowed smallint NOT NULL DEFAULT 1,
|
||||
required_template_id integer DEFAULT NULL,
|
||||
allowed_roles character varying(255) DEFAULT NULL,
|
||||
CONSTRAINT host_template_choice_required_template
|
||||
FOREIGN KEY (required_template_id)
|
||||
REFERENCES icinga_host (id)
|
||||
ON DELETE RESTRICT
|
||||
ON UPDATE CASCADE,
|
||||
PRIMARY KEY (id)
|
||||
);
|
||||
|
||||
CREATE UNIQUE INDEX host_template_choice_object_name ON icinga_host_template_choice (object_name);
|
||||
CREATE INDEX host_template_choice_required_template ON icinga_host_template_choice (required_template_id);
|
||||
|
||||
CREATE TABLE icinga_host (
|
||||
id serial,
|
||||
@ -725,10 +733,18 @@ CREATE TABLE icinga_service_template_choice (
|
||||
description text DEFAULT NULL,
|
||||
min_required smallint NOT NULL DEFAULT 0,
|
||||
max_allowed smallint NOT NULL DEFAULT 1,
|
||||
required_template_id integer DEFAULT NULL,
|
||||
allowed_roles character varying(255) DEFAULT NULL,
|
||||
CONSTRAINT service_template_choice_required_template
|
||||
FOREIGN KEY (required_template_id)
|
||||
REFERENCES icinga_service (id)
|
||||
ON DELETE RESTRICT
|
||||
ON UPDATE CASCADE,
|
||||
PRIMARY KEY (id)
|
||||
);
|
||||
|
||||
CREATE UNIQUE INDEX service_template_choice_object_name ON icinga_service_template_choice (object_name);
|
||||
CREATE INDEX service_template_choice_required_template ON icinga_service_template_choice (required_template_id);
|
||||
|
||||
|
||||
CREATE TABLE icinga_service (
|
||||
@ -1841,4 +1857,4 @@ CREATE INDEX user_resolved_var_schecksum ON icinga_user_resolved_var (checksum);
|
||||
|
||||
INSERT INTO director_schema_migration
|
||||
(schema_version, migration_time)
|
||||
VALUES (142, NOW());
|
||||
VALUES (143, NOW());
|
||||
|
Loading…
x
Reference in New Issue
Block a user