diff --git a/schema/mysql-migrations/upgrade_152.sql b/schema/mysql-migrations/upgrade_152.sql new file mode 100644 index 00000000..91e8eea3 --- /dev/null +++ b/schema/mysql-migrations/upgrade_152.sql @@ -0,0 +1,9 @@ +ALTER TABLE import_source + ADD UNIQUE INDEX source_name (source_name); + +ALTER TABLE sync_rule + ADD UNIQUE INDEX rule_name (rule_name); + +INSERT INTO director_schema_migration + (schema_version, migration_time) + VALUES (152, NOW()); diff --git a/schema/mysql.sql b/schema/mysql.sql index ee314a04..6a87b13e 100644 --- a/schema/mysql.sql +++ b/schema/mysql.sql @@ -1296,6 +1296,7 @@ CREATE TABLE import_source ( last_attempt DATETIME DEFAULT NULL, description TEXT DEFAULT NULL, PRIMARY KEY (id), + UNIQUE INDEX source_name (source_name), INDEX search_idx (key_column) ) ENGINE=InnoDB DEFAULT CHARSET=utf8; @@ -1441,7 +1442,8 @@ CREATE TABLE sync_rule ( last_error_message TEXT DEFAULT NULL, last_attempt DATETIME DEFAULT NULL, description TEXT DEFAULT NULL, - PRIMARY KEY (id) + PRIMARY KEY (id), + UNIQUE INDEX rule_name (rule_name) ) ENGINE=InnoDB DEFAULT CHARSET=utf8; CREATE TABLE sync_property ( @@ -1730,4 +1732,4 @@ CREATE TABLE icinga_timeperiod_exclude ( INSERT INTO director_schema_migration (schema_version, migration_time) - VALUES (151, NOW()); + VALUES (152, NOW()); diff --git a/schema/pgsql-migrations/upgrade_152.sql b/schema/pgsql-migrations/upgrade_152.sql new file mode 100644 index 00000000..b1d816c0 --- /dev/null +++ b/schema/pgsql-migrations/upgrade_152.sql @@ -0,0 +1,7 @@ +CREATE UNIQUE INDEX import_source_name ON import_source (source_name); + +CREATE UNIQUE INDEX sync_rule_name ON sync_rule (rule_name); + +INSERT INTO director_schema_migration + (schema_version, migration_time) +VALUES (152, NOW()); diff --git a/schema/pgsql.sql b/schema/pgsql.sql index 962b98c5..93618733 100644 --- a/schema/pgsql.sql +++ b/schema/pgsql.sql @@ -1439,6 +1439,7 @@ CREATE TABLE import_source ( ); CREATE INDEX import_source_search_idx ON import_source (key_column); +CREATE UNIQUE INDEX import_source_name ON import_source (source_name); CREATE TABLE import_source_setting ( @@ -1594,6 +1595,7 @@ CREATE TABLE sync_rule ( PRIMARY KEY (id) ); +CREATE UNIQUE INDEX sync_rule_name ON sync_rule (rule_name); CREATE TABLE sync_property ( id serial, @@ -2025,4 +2027,4 @@ CREATE TABLE icinga_timeperiod_exclude ( INSERT INTO director_schema_migration (schema_version, migration_time) - VALUES (151, NOW()); + VALUES (152, NOW());