diff --git a/patches/patch20200710-3.0.0-rc2/versioning.sql b/patches/patch20200710-3.0.0-rc2/versioning.sql index 9cbfca73b92b37056d041f8aeab84e6a55520276..2be99257db4516472f80946ded1b1a584f965030 100644 --- a/patches/patch20200710-3.0.0-rc2/versioning.sql +++ b/patches/patch20200710-3.0.0-rc2/versioning.sql @@ -58,7 +58,7 @@ CREATE TABLE entity_version ( PRIMARY KEY (`entity_id`, `_iversion`), FOREIGN KEY (`entity_id`) REFERENCES `entities` (`id`) ON DELETE CASCADE, FOREIGN KEY (`srid`) REFERENCES `transactions` (`srid`), - UNIQUE (`entity_id`, `version`) + UNIQUE `entity_version-e-v` (`entity_id`, `version`) ) ENGINE=InnoDB; ALTER TABLE reference_data @@ -230,7 +230,7 @@ CREATE TABLE archive_name_overrides ( property_id INT UNSIGNED NOT NULL, name VARCHAR(255) NOT NULL, _iversion INT UNSIGNED NOT NULL, - UNIQUE KEY (`domain_id`, `entity_id`, `property_id`, `_iversion`), + UNIQUE KEY `archive_name_overrides-d-e-p-v` (`domain_id`, `entity_id`, `property_id`, `_iversion`), KEY (`domain_id`, `entity_id`, `_iversion`), KEY (`domain_id`, `_iversion`), FOREIGN KEY (`domain_id`) REFERENCES `entities` (`id`) ON DELETE CASCADE, @@ -244,7 +244,7 @@ CREATE TABLE archive_desc_overrides ( property_id INT UNSIGNED NOT NULL, description TEXT NOT NULL, _iversion INT UNSIGNED NOT NULL, - UNIQUE KEY (`domain_id`, `entity_id`, `property_id`, `_iversion`), + UNIQUE KEY `archive_desc_overrides-d-e-p-v` (`domain_id`, `entity_id`, `property_id`, `_iversion`), KEY (`domain_id`, `entity_id`, `_iversion`), KEY (`domain_id`, `_iversion`), FOREIGN KEY (`domain_id`) REFERENCES `entities` (`id`) ON DELETE CASCADE, @@ -258,7 +258,7 @@ CREATE TABLE archive_data_type ( property_id INT UNSIGNED NOT NULL, datatype INT UNSIGNED NOT NULL, _iversion INT UNSIGNED NOT NULL, - UNIQUE KEY (`domain_id`, `entity_id`, `property_id`, `_iversion`), + UNIQUE KEY `archive_data_type-d-e-p-v` (`domain_id`, `entity_id`, `property_id`, `_iversion`), KEY (`domain_id`, `entity_id`, `_iversion`), KEY (`domain_id`, `_iversion`), FOREIGN KEY (`domain_id`) REFERENCES `entities` (`id`) ON DELETE CASCADE, @@ -273,7 +273,7 @@ CREATE TABLE archive_collection_type ( property_id INT UNSIGNED NOT NULL, collection VARCHAR(255) NOT NULL, _iversion INT UNSIGNED NOT NULL, - UNIQUE KEY (`domain_id`, `entity_id`, `property_id`, `_iversion`), + UNIQUE KEY `archive_collection_type-d-e-p-v` (`domain_id`, `entity_id`, `property_id`, `_iversion`), KEY (`domain_id`, `entity_id`, `_iversion`), KEY (`domain_id`, `_iversion`), FOREIGN KEY (`domain_id`) REFERENCES `entities` (`id`) ON DELETE CASCADE, @@ -314,6 +314,6 @@ CREATE TABLE archive_entities ( FOREIGN KEY (`acl`) REFERENCES `entity_acl` (`id`) ) ENGINE=InnoDB; - +ALTER IGNORE TABLE collection_type ADD UNIQUE KEY `collection_type-d-e-p` (`domain_id`, `entity_id`, `property_id`); INSERT INTO feature_config (_key, _value) VALUES ("ENTITY_VERSIONING", "ENABLED"); diff --git a/tests/test_autotap.sql b/tests/test_autotap.sql index b8a2d1aa2e14c5b0e6e8c99198678028f5a5daa3..26af8b87fbf61e98ef34f0a2a6b37efb296452c1 100644 --- a/tests/test_autotap.sql +++ b/tests/test_autotap.sql @@ -102,7 +102,7 @@ SELECT tap.index_is_type('_caosdb_schema_unit_tests','collection_type','property SELECT tap.is_indexed('_caosdb_schema_unit_tests','collection_type','`property_id`',''); -- CONSTRAINTS -SELECT tap.constraints_are('_caosdb_schema_unit_tests','collection_type','`collection_type_domain_id_entity`,`collection_type_entity_id_entity`,`collection_type_property_id_entity`',''); +SELECT tap.constraints_are('_caosdb_schema_unit_tests','collection_type','`collection_type-d-e-p`,`collection_type_domain_id_entity`,`collection_type_entity_id_entity`,`collection_type_property_id_entity`',''); -- CONSTRAINT collection_type.collection_type_domain_id_entity @@ -2291,12 +2291,12 @@ SELECT tap.col_charset_is('_caosdb_schema_unit_tests','entity_version','srid',NU SELECT tap.col_collation_is('_caosdb_schema_unit_tests','entity_version','srid',NULL,''); -- CONSTRAINTS -SELECT tap.constraints_are('_caosdb_schema_unit_tests','entity_version','`entity_id`,`PRIMARY`,`entity_version_ibfk_1`,`entity_version_ibfk_2`',''); +SELECT tap.constraints_are('_caosdb_schema_unit_tests','entity_version','`entity_version-e-v`,`PRIMARY`,`entity_version_ibfk_1`,`entity_version_ibfk_2`',''); -- CONSTRAINT entity_version.entity_id -SELECT tap.has_constraint('_caosdb_schema_unit_tests','entity_version','entity_id',''); -SELECT tap.constraint_type_is('_caosdb_schema_unit_tests','entity_version','entity_id','UNIQUE',''); +SELECT tap.has_constraint('_caosdb_schema_unit_tests','entity_version','entity_version-e-v',''); +SELECT tap.constraint_type_is('_caosdb_schema_unit_tests','entity_version','entity_version-e-v','UNIQUE',''); -- CONSTRAINT entity_version.PRIMARY