Skip to content
Snippets Groups Projects
Verified Commit ef41343a authored by Timm Fitschen's avatar Timm Fitschen
Browse files

FIX: collection_type constraint

parent d3d5c099
No related branches found
No related tags found
No related merge requests found
......@@ -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");
......@@ -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
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment