diff --git a/schema/mysql-migrations/upgrade_188.sql b/schema/mysql-migrations/upgrade_188.sql new file mode 100644 index 000000000..764215185 --- /dev/null +++ b/schema/mysql-migrations/upgrade_188.sql @@ -0,0 +1,14 @@ +ALTER TABLE director_activity_log +DROP INDEX checksum, +ADD UNIQUE INDEX checksum (checksum); + +ALTER TABLE director_generated_config +ADD CONSTRAINT director_generated_config_activity + FOREIGN KEY (last_activity_checksum) + REFERENCES director_activity_log (checksum) + ON DELETE RESTRICT + ON UPDATE RESTRICT; + +INSERT INTO director_schema_migration + (schema_version, migration_time) + VALUES (188, NOW()); diff --git a/schema/mysql.sql b/schema/mysql.sql index 832ab122d..dd8a0f849 100644 --- a/schema/mysql.sql +++ b/schema/mysql.sql @@ -46,7 +46,7 @@ CREATE TABLE director_activity_log ( INDEX search_idx (object_name), INDEX search_idx2 (object_type(32), object_name(64), change_time), INDEX search_author (author), - INDEX checksum (checksum) + UNIQUE INDEX checksum (checksum) ) ENGINE=InnoDB DEFAULT CHARSET=utf8; CREATE TABLE director_activity_log_remark ( @@ -114,7 +114,7 @@ CREATE TABLE director_generated_config ( last_activity_checksum VARBINARY(20) NOT NULL, PRIMARY KEY (checksum), CONSTRAINT director_generated_config_activity - FOREIGN KEY activity_checksum (last_activity_checksum) + FOREIGN KEY (last_activity_checksum) REFERENCES director_activity_log (checksum) ON DELETE RESTRICT ON UPDATE RESTRICT @@ -2446,4 +2446,4 @@ CREATE TABLE branched_icinga_dependency ( INSERT INTO director_schema_migration (schema_version, migration_time) - VALUES (187, NOW()); + VALUES (188, NOW());