diff --git a/schema/mysql-changes/upgrade_41.sql b/schema/mysql-changes/upgrade_41.sql new file mode 100644 index 00000000..0ddb9b67 --- /dev/null +++ b/schema/mysql-changes/upgrade_41.sql @@ -0,0 +1,19 @@ +DROP TABLE icinga_command_field; + +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 + FOREIGN KEY command_id (command_id) + REFERENCES icinga_command (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 376e3daf..e29a24be 100644 --- a/schema/mysql.sql +++ b/schema/mysql.sql @@ -293,9 +293,9 @@ CREATE TABLE icinga_command_field ( 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) + CONSTRAINT icinga_command_field_command + FOREIGN KEY command_id (command_id) + REFERENCES icinga_command (id) ON DELETE CASCADE ON UPDATE CASCADE, CONSTRAINT icinga_command_field_datafield