schema: fix table order

This commit is contained in:
Thomas Gelf 2017-09-28 14:21:29 +02:00
parent 3fd4748e01
commit 1301811281
2 changed files with 74 additions and 73 deletions

View File

@ -422,23 +422,6 @@ CREATE TABLE icinga_endpoint_inheritance (
ON UPDATE CASCADE
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
CREATE TABLE icinga_host_template_choice (
id INT(10) UNSIGNED AUTO_INCREMENT NOT NULL,
object_name VARCHAR(64) NOT NULL,
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;
CREATE TABLE icinga_host (
id INT(10) UNSIGNED NOT NULL AUTO_INCREMENT,
object_name VARCHAR(255) NOT NULL,
@ -562,6 +545,23 @@ CREATE TABLE icinga_host_var (
ON UPDATE CASCADE
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
CREATE TABLE icinga_host_template_choice (
id INT(10) UNSIGNED AUTO_INCREMENT NOT NULL,
object_name VARCHAR(64) NOT NULL,
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;
CREATE TABLE icinga_service_set (
id INT(10) UNSIGNED NOT NULL AUTO_INCREMENT,
object_name VARCHAR(128) NOT NULL,
@ -578,23 +578,6 @@ CREATE TABLE icinga_service_set (
ON UPDATE CASCADE
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
CREATE TABLE icinga_service_template_choice (
id INT(10) UNSIGNED AUTO_INCREMENT NOT NULL,
object_name VARCHAR(64) NOT NULL,
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;
CREATE TABLE icinga_service (
id INT(10) UNSIGNED NOT NULL AUTO_INCREMENT,
object_name VARCHAR(255) NOT NULL,
@ -726,6 +709,23 @@ CREATE TABLE icinga_service_field (
ON UPDATE CASCADE
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
CREATE TABLE icinga_service_template_choice (
id INT(10) UNSIGNED AUTO_INCREMENT NOT NULL,
object_name VARCHAR(64) NOT NULL,
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;
CREATE TABLE icinga_host_service (
host_id INT(10) UNSIGNED NOT NULL,
service_id INT(10) UNSIGNED NOT NULL,

View File

@ -545,25 +545,6 @@ CREATE INDEX endpoint_inheritance_endpoint ON icinga_endpoint_inheritance (endpo
CREATE INDEX endpoint_inheritance_endpoint_parent ON icinga_endpoint_inheritance (parent_endpoint_id);
CREATE TABLE icinga_host_template_choice (
id serial,
object_name character varying(64) NOT NULL,
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,
object_name character varying(255) NOT NULL,
@ -708,6 +689,26 @@ CREATE INDEX host_var_host ON icinga_host_var (host_id);
CREATE INDEX host_var_checksum ON icinga_host_var (checksum);
CREATE TABLE icinga_host_template_choice (
id serial,
object_name character varying(64) NOT NULL,
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_service_set (
id serial,
host_id integer DEFAULT NULL,
@ -727,26 +728,6 @@ CREATE UNIQUE INDEX service_set_name ON icinga_service_set (object_name, host_id
CREATE INDEX service_set_host ON icinga_service_set (host_id);
CREATE TABLE icinga_service_template_choice (
id serial,
object_name character varying(64) NOT NULL,
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 (
id serial,
object_name character varying(255) NOT NULL,
@ -899,6 +880,26 @@ CREATE INDEX service_field_datafield ON icinga_service_field (datafield_id);
COMMENT ON COLUMN icinga_service_field.service_id IS 'Makes only sense for templates';
CREATE TABLE icinga_service_template_choice (
id serial,
object_name character varying(64) NOT NULL,
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_host_service (
host_id integer NOT NULL,
service_id integer NOT NULL,