From c118b240560d39e517841ad1f18615a1a24e565d Mon Sep 17 00:00:00 2001 From: Thomas Gelf Date: Mon, 1 Jun 2015 16:36:57 +0200 Subject: [PATCH] schema: unique constraint on command argument --- schema/mysql-changes/upgrade_2.sql | 1 + schema/mysql.sql | 1 + 2 files changed, 2 insertions(+) create mode 100644 schema/mysql-changes/upgrade_2.sql diff --git a/schema/mysql-changes/upgrade_2.sql b/schema/mysql-changes/upgrade_2.sql new file mode 100644 index 00000000..04f37333 --- /dev/null +++ b/schema/mysql-changes/upgrade_2.sql @@ -0,0 +1 @@ +ALTER TABLE icinga_command_argument ADD UNIQUE KEY unique_idx (command_id, argument_name); diff --git a/schema/mysql.sql b/schema/mysql.sql index c846f5c1..06b486a1 100644 --- a/schema/mysql.sql +++ b/schema/mysql.sql @@ -195,6 +195,7 @@ CREATE TABLE icinga_command_argument ( set_if_format ENUM('string', 'expression', 'json') DEFAULT NULL, PRIMARY KEY (id), UNIQUE INDEX sort_idx (command_id, sort_order), + UNIQUE KEY unique_idx (command_id, argument_name), CONSTRAINT icinga_command_argument_command FOREIGN KEY command (command_id) REFERENCES icinga_command (id)