SQLSchema: Add icinga_ host, service _field tables
This commit is contained in:
parent
9b8c453ff9
commit
6e0b430dcc
|
@ -0,0 +1,43 @@
|
||||||
|
CREATE TABLE icinga_host_field (
|
||||||
|
host_id INT(10) UNSIGNED NOT NULL COMMENT 'Makes only sense for templates',
|
||||||
|
fieldname VARCHAR(64) NOT NULL,
|
||||||
|
caption VARCHAR(255) NOT NULL,
|
||||||
|
datatype_id INT(10) UNSIGNED NOT NULL,
|
||||||
|
-- datatype_param? multiple ones?
|
||||||
|
default_value TEXT DEFAULT NULL,
|
||||||
|
format enum ('string', 'json', 'expression'),
|
||||||
|
PRIMARY KEY (host_id, fieldname),
|
||||||
|
KEY search_idx (fieldname),
|
||||||
|
CONSTRAINT icinga_host_field_host
|
||||||
|
FOREIGN KEY host(host_id)
|
||||||
|
REFERENCES icinga_host (id)
|
||||||
|
ON DELETE CASCADE
|
||||||
|
ON UPDATE CASCADE,
|
||||||
|
CONSTRAINT icinga_host_field_datatype
|
||||||
|
FOREIGN KEY datatype (datatype_id)
|
||||||
|
REFERENCES director_datatype (id)
|
||||||
|
ON DELETE RESTRICT
|
||||||
|
ON UPDATE CASCADE
|
||||||
|
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
|
||||||
|
|
||||||
|
CREATE TABLE icinga_service_field (
|
||||||
|
service_id INT(10) UNSIGNED NOT NULL COMMENT 'Makes only sense for templates',
|
||||||
|
fieldname VARCHAR(64) NOT NULL,
|
||||||
|
caption VARCHAR(255) NOT NULL,
|
||||||
|
datatype_id INT(10) UNSIGNED NOT NULL,
|
||||||
|
-- datatype_param? multiple ones?
|
||||||
|
default_value TEXT DEFAULT NULL,
|
||||||
|
format enum ('string', 'json', 'expression'),
|
||||||
|
PRIMARY KEY (service_id, fieldname),
|
||||||
|
KEY search_idx (fieldname),
|
||||||
|
CONSTRAINT icinga_service_field_service
|
||||||
|
FOREIGN KEY service (service_id)
|
||||||
|
REFERENCES icinga_service (id)
|
||||||
|
ON DELETE CASCADE
|
||||||
|
ON UPDATE CASCADE,
|
||||||
|
CONSTRAINT icinga_service_field_datatype
|
||||||
|
FOREIGN KEY datatype (datatype_id)
|
||||||
|
REFERENCES director_datatype (id)
|
||||||
|
ON DELETE RESTRICT
|
||||||
|
ON UPDATE CASCADE
|
||||||
|
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
|
|
@ -116,7 +116,7 @@ CREATE TABLE director_datalist_entry (
|
||||||
CREATE TABLE director_datatype (
|
CREATE TABLE director_datatype (
|
||||||
id INT(10) UNSIGNED AUTO_INCREMENT NOT NULL,
|
id INT(10) UNSIGNED AUTO_INCREMENT NOT NULL,
|
||||||
datatype_name VARCHAR(255) NOT NULL,
|
datatype_name VARCHAR(255) NOT NULL,
|
||||||
-- ?? expression VARCHAR(255) NOT NULL,
|
datatype_class VARCHAR(255) NOT NULL,
|
||||||
PRIMARY KEY (id),
|
PRIMARY KEY (id),
|
||||||
UNIQUE KEY datatype_name (datatype_name)
|
UNIQUE KEY datatype_name (datatype_name)
|
||||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
|
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
|
||||||
|
@ -387,6 +387,28 @@ CREATE TABLE icinga_host_inheritance (
|
||||||
ON UPDATE CASCADE
|
ON UPDATE CASCADE
|
||||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
|
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
|
||||||
|
|
||||||
|
CREATE TABLE icinga_host_field (
|
||||||
|
host_id INT(10) UNSIGNED NOT NULL COMMENT 'Makes only sense for templates',
|
||||||
|
fieldname VARCHAR(64) NOT NULL,
|
||||||
|
caption VARCHAR(255) NOT NULL,
|
||||||
|
datatype_id INT(10) UNSIGNED NOT NULL,
|
||||||
|
-- datatype_param? multiple ones?
|
||||||
|
default_value TEXT DEFAULT NULL,
|
||||||
|
format enum ('string', 'json', 'expression'),
|
||||||
|
PRIMARY KEY (host_id, fieldname),
|
||||||
|
KEY search_idx (fieldname),
|
||||||
|
CONSTRAINT icinga_host_field_host
|
||||||
|
FOREIGN KEY host(host_id)
|
||||||
|
REFERENCES icinga_host (id)
|
||||||
|
ON DELETE CASCADE
|
||||||
|
ON UPDATE CASCADE,
|
||||||
|
CONSTRAINT icinga_host_field_datatype
|
||||||
|
FOREIGN KEY datatype (datatype_id)
|
||||||
|
REFERENCES director_datatype (id)
|
||||||
|
ON DELETE RESTRICT
|
||||||
|
ON UPDATE CASCADE
|
||||||
|
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
|
||||||
|
|
||||||
CREATE TABLE icinga_host_var (
|
CREATE TABLE icinga_host_var (
|
||||||
host_id INT(10) UNSIGNED NOT NULL,
|
host_id INT(10) UNSIGNED NOT NULL,
|
||||||
varname VARCHAR(255) DEFAULT NULL,
|
varname VARCHAR(255) DEFAULT NULL,
|
||||||
|
@ -488,6 +510,28 @@ CREATE TABLE icinga_service_var (
|
||||||
ON UPDATE CASCADE
|
ON UPDATE CASCADE
|
||||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
|
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
|
||||||
|
|
||||||
|
CREATE TABLE icinga_service_field (
|
||||||
|
service_id INT(10) UNSIGNED NOT NULL COMMENT 'Makes only sense for templates',
|
||||||
|
fieldname VARCHAR(64) NOT NULL,
|
||||||
|
caption VARCHAR(255) NOT NULL,
|
||||||
|
datatype_id INT(10) UNSIGNED NOT NULL,
|
||||||
|
-- datatype_param? multiple ones?
|
||||||
|
default_value TEXT DEFAULT NULL,
|
||||||
|
format enum ('string', 'json', 'expression'),
|
||||||
|
PRIMARY KEY (service_id, fieldname),
|
||||||
|
KEY search_idx (fieldname),
|
||||||
|
CONSTRAINT icinga_service_field_service
|
||||||
|
FOREIGN KEY service (service_id)
|
||||||
|
REFERENCES icinga_service (id)
|
||||||
|
ON DELETE CASCADE
|
||||||
|
ON UPDATE CASCADE,
|
||||||
|
CONSTRAINT icinga_service_field_datatype
|
||||||
|
FOREIGN KEY datatype (datatype_id)
|
||||||
|
REFERENCES director_datatype (id)
|
||||||
|
ON DELETE RESTRICT
|
||||||
|
ON UPDATE CASCADE
|
||||||
|
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
|
||||||
|
|
||||||
CREATE TABLE icinga_host_service (
|
CREATE TABLE icinga_host_service (
|
||||||
host_id INT(10) UNSIGNED NOT NULL,
|
host_id INT(10) UNSIGNED NOT NULL,
|
||||||
service_id INT(10) UNSIGNED NOT NULL,
|
service_id INT(10) UNSIGNED NOT NULL,
|
||||||
|
|
|
@ -0,0 +1,52 @@
|
||||||
|
CREATE TABLE icinga_host_field (
|
||||||
|
host_id integer NOT NULL,
|
||||||
|
fieldname character varying(64) NOT NULL,
|
||||||
|
caption character varying(255) NOT NULL,
|
||||||
|
datatype_id integer NOT NULL,
|
||||||
|
-- datatype_param? multiple ones?
|
||||||
|
default_value text DEFAULT NULL,
|
||||||
|
format enum_property_format,
|
||||||
|
PRIMARY KEY (host_id, fieldname),
|
||||||
|
CONSTRAINT icinga_host_field_host
|
||||||
|
FOREIGN KEY (host_id)
|
||||||
|
REFERENCES icinga_host (id)
|
||||||
|
ON DELETE CASCADE
|
||||||
|
ON UPDATE CASCADE,
|
||||||
|
CONSTRAINT icinga_host_field_datatype
|
||||||
|
FOREIGN KEY datatype (datatype_id)
|
||||||
|
REFERENCES director_datatype (id)
|
||||||
|
ON DELETE RESTRICT
|
||||||
|
ON UPDATE CASCADE
|
||||||
|
);
|
||||||
|
|
||||||
|
CREATE UNIQUE INDEX host_field_key ON icinga_host_field (host_id, fieldname);
|
||||||
|
CREATE INDEX host_field_search_idx ON icinga_host_field (fieldname);
|
||||||
|
CREATE INDEX host_field_host ON icinga_host_field (host_id);
|
||||||
|
COMMENT ON COLUMN icinga_host_field.host_id IS 'Makes only sense for templates';
|
||||||
|
|
||||||
|
|
||||||
|
CREATE TABLE icinga_service_field (
|
||||||
|
service_id integer NOT NULL,
|
||||||
|
fieldname character varying(64) NOT NULL,
|
||||||
|
caption character varying(255) NOT NULL,
|
||||||
|
datatype_id integer NOT NULL,
|
||||||
|
-- datatype_param? multiple ones?
|
||||||
|
default_value text DEFAULT NULL,
|
||||||
|
format enum_property_format,
|
||||||
|
PRIMARY KEY (service_id, fieldname),
|
||||||
|
CONSTRAINT icinga_service_field_service
|
||||||
|
FOREIGN KEY (service_id)
|
||||||
|
REFERENCES icinga_service (id)
|
||||||
|
ON DELETE CASCADE
|
||||||
|
ON UPDATE CASCADE,
|
||||||
|
CONSTRAINT icinga_service_field_datatype
|
||||||
|
FOREIGN KEY datatype (datatype_id)
|
||||||
|
REFERENCES director_datatype (id)
|
||||||
|
ON DELETE RESTRICT
|
||||||
|
ON UPDATE CASCADE
|
||||||
|
);
|
||||||
|
|
||||||
|
CREATE UNIQUE INDEX service_field_key ON icinga_service_field (service_id, fieldname);
|
||||||
|
CREATE INDEX service_field_search_idx ON icinga_service_field (fieldname);
|
||||||
|
CREATE INDEX service_field_service ON icinga_service_field (service_id);
|
||||||
|
COMMENT ON COLUMN icinga_service_field.service_id IS 'Makes only sense for templates';
|
|
@ -482,6 +482,33 @@ CREATE INDEX host_inheritance_host ON icinga_host_inheritance (host_id);
|
||||||
CREATE INDEX host_inheritance_host_parent ON icinga_host_inheritance (parent_host_id);
|
CREATE INDEX host_inheritance_host_parent ON icinga_host_inheritance (parent_host_id);
|
||||||
|
|
||||||
|
|
||||||
|
CREATE TABLE icinga_host_field (
|
||||||
|
host_id integer NOT NULL,
|
||||||
|
fieldname character varying(64) NOT NULL,
|
||||||
|
caption character varying(255) NOT NULL,
|
||||||
|
datatype_id integer NOT NULL,
|
||||||
|
-- datatype_param? multiple ones?
|
||||||
|
default_value text DEFAULT NULL,
|
||||||
|
format enum_property_format,
|
||||||
|
PRIMARY KEY (host_id, fieldname),
|
||||||
|
CONSTRAINT icinga_host_field_host
|
||||||
|
FOREIGN KEY (host_id)
|
||||||
|
REFERENCES icinga_host (id)
|
||||||
|
ON DELETE CASCADE
|
||||||
|
ON UPDATE CASCADE,
|
||||||
|
CONSTRAINT icinga_host_field_datatype
|
||||||
|
FOREIGN KEY datatype (datatype_id)
|
||||||
|
REFERENCES director_datatype (id)
|
||||||
|
ON DELETE RESTRICT
|
||||||
|
ON UPDATE CASCADE
|
||||||
|
);
|
||||||
|
|
||||||
|
CREATE UNIQUE INDEX host_field_key ON icinga_host_field (host_id, fieldname);
|
||||||
|
CREATE INDEX host_field_search_idx ON icinga_host_field (fieldname);
|
||||||
|
CREATE INDEX host_field_host ON icinga_host_field (host_id);
|
||||||
|
COMMENT ON COLUMN icinga_host_field.host_id IS 'Makes only sense for templates';
|
||||||
|
|
||||||
|
|
||||||
CREATE TABLE icinga_host_var (
|
CREATE TABLE icinga_host_var (
|
||||||
host_id integer NOT NULL,
|
host_id integer NOT NULL,
|
||||||
varname character varying(255) DEFAULT NULL,
|
varname character varying(255) DEFAULT NULL,
|
||||||
|
@ -583,6 +610,33 @@ CREATE INDEX service_inheritance_service ON icinga_service_inheritance (service_
|
||||||
CREATE INDEX service_inheritance_service_parent ON icinga_service_inheritance (parent_service_id);
|
CREATE INDEX service_inheritance_service_parent ON icinga_service_inheritance (parent_service_id);
|
||||||
|
|
||||||
|
|
||||||
|
CREATE TABLE icinga_service_field (
|
||||||
|
service_id integer NOT NULL,
|
||||||
|
fieldname character varying(64) NOT NULL,
|
||||||
|
caption character varying(255) NOT NULL,
|
||||||
|
datatype_id integer NOT NULL,
|
||||||
|
-- datatype_param? multiple ones?
|
||||||
|
default_value text DEFAULT NULL,
|
||||||
|
format enum_property_format,
|
||||||
|
PRIMARY KEY (service_id, fieldname),
|
||||||
|
CONSTRAINT icinga_service_field_service
|
||||||
|
FOREIGN KEY (service_id)
|
||||||
|
REFERENCES icinga_service (id)
|
||||||
|
ON DELETE CASCADE
|
||||||
|
ON UPDATE CASCADE,
|
||||||
|
CONSTRAINT icinga_service_field_datatype
|
||||||
|
FOREIGN KEY datatype (datatype_id)
|
||||||
|
REFERENCES director_datatype (id)
|
||||||
|
ON DELETE RESTRICT
|
||||||
|
ON UPDATE CASCADE
|
||||||
|
);
|
||||||
|
|
||||||
|
CREATE UNIQUE INDEX service_field_key ON icinga_service_field (service_id, fieldname);
|
||||||
|
CREATE INDEX service_field_search_idx ON icinga_service_field (fieldname);
|
||||||
|
CREATE INDEX service_field_service ON icinga_service_field (service_id);
|
||||||
|
COMMENT ON COLUMN icinga_service_field.service_id IS 'Makes only sense for templates';
|
||||||
|
|
||||||
|
|
||||||
CREATE TABLE icinga_service_var (
|
CREATE TABLE icinga_service_var (
|
||||||
service_id integer NOT NULL,
|
service_id integer NOT NULL,
|
||||||
varname character varying(255) DEFAULT NULL,
|
varname character varying(255) DEFAULT NULL,
|
||||||
|
|
Loading…
Reference in New Issue