schema/mysql: fix creation, migrations where fine

fixes #1204
This commit is contained in:
Thomas Gelf 2017-09-28 14:44:47 +02:00
parent 312c611e80
commit c3b23a836a
1 changed files with 14 additions and 10 deletions

View File

@ -430,11 +430,6 @@ CREATE TABLE icinga_host_template_choice (
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;
@ -562,6 +557,13 @@ CREATE TABLE icinga_host_var (
ON UPDATE CASCADE
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
ALTER TABLE icinga_host_template_choice
ADD CONSTRAINT host_template_choice_required_template
FOREIGN KEY required_template (required_template_id)
REFERENCES icinga_host (id)
ON DELETE RESTRICT
ON UPDATE CASCADE;
CREATE TABLE icinga_service_set (
id INT(10) UNSIGNED NOT NULL AUTO_INCREMENT,
object_name VARCHAR(128) NOT NULL,
@ -586,11 +588,6 @@ CREATE TABLE icinga_service_template_choice (
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;
@ -726,6 +723,13 @@ CREATE TABLE icinga_service_field (
ON UPDATE CASCADE
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
ALTER TABLE icinga_service_template_choice
ADD CONSTRAINT service_template_choice_required_template
FOREIGN KEY required_template (required_template_id)
REFERENCES icinga_service (id)
ON DELETE RESTRICT
ON UPDATE CASCADE;
CREATE TABLE icinga_host_service (
host_id INT(10) UNSIGNED NOT NULL,
service_id INT(10) UNSIGNED NOT NULL,