From 107aca885dec6d7f42dc5b0f81261f339b2b4d9e Mon Sep 17 00:00:00 2001 From: Thomas Gelf Date: Fri, 28 Aug 2015 17:22:42 +0200 Subject: [PATCH] schema/mysql: add command fields --- schema/mysql-changes/upgrade_37.sql | 17 +++++++++++++++++ schema/mysql.sql | 17 +++++++++++++++++ 2 files changed, 34 insertions(+) create mode 100644 schema/mysql-changes/upgrade_37.sql diff --git a/schema/mysql-changes/upgrade_37.sql b/schema/mysql-changes/upgrade_37.sql new file mode 100644 index 00000000..2533370d --- /dev/null +++ b/schema/mysql-changes/upgrade_37.sql @@ -0,0 +1,17 @@ +CREATE TABLE icinga_command_field ( + command_id INT(10) UNSIGNED NOT NULL, + datafield_id INT(10) UNSIGNED NOT NULL, + is_required ENUM('y', 'n') NOT NULL, + PRIMARY KEY (command_id, datafield_id), + CONSTRAINT icinga_command_field_command_argument + FOREIGN KEY host(command_id) + REFERENCES icinga_command_argument (id) + ON DELETE CASCADE + ON UPDATE CASCADE, + CONSTRAINT icinga_command_field_datafield + FOREIGN KEY datafield(datafield_id) + REFERENCES director_datafield (id) + ON DELETE CASCADE + ON UPDATE CASCADE +) ENGINE=InnoDB DEFAULT CHARSET=utf8; + diff --git a/schema/mysql.sql b/schema/mysql.sql index edca27a6..1fe3c101 100644 --- a/schema/mysql.sql +++ b/schema/mysql.sql @@ -281,6 +281,23 @@ CREATE TABLE icinga_command_argument ( ON UPDATE CASCADE ) ENGINE=InnoDB DEFAULT CHARSET=utf8; +CREATE TABLE icinga_command_field ( + command_id INT(10) UNSIGNED NOT NULL, + datafield_id INT(10) UNSIGNED NOT NULL, + is_required ENUM('y', 'n') NOT NULL, + PRIMARY KEY (command_id, datafield_id), + CONSTRAINT icinga_command_field_command_argument + FOREIGN KEY host(command_id) + REFERENCES icinga_command_argument (id) + ON DELETE CASCADE + ON UPDATE CASCADE, + CONSTRAINT icinga_command_field_datafield + FOREIGN KEY datafield(datafield_id) + REFERENCES director_datafield (id) + ON DELETE CASCADE + ON UPDATE CASCADE +) ENGINE=InnoDB DEFAULT CHARSET=utf8; + CREATE TABLE icinga_command_var ( command_id INT(10) UNSIGNED NOT NULL, varname VARCHAR(255) DEFAULT NULL,