DROP TABLE IF EXISTS `userfield_values`;
|
/*!40101 SET @saved_cs_client = @@character_set_client */;
|
/*!40101 SET character_set_client = utf8 */;
|
CREATE TABLE `userfield_values` (
|
`value_id` int(11) NOT NULL AUTO_INCREMENT,
|
`field_id` int(11) NOT NULL,
|
`party_id` int(11) DEFAULT NULL,
|
`case_id` int(11) DEFAULT NULL,
|
`case_template_id` int(11) DEFAULT NULL,
|
`office_id` int(11) DEFAULT NULL,
|
`user_id` int(11) DEFAULT NULL,
|
`text` text DEFAULT NULL,
|
`number` int(11) DEFAULT NULL,
|
`dateandtime` datetime DEFAULT NULL,
|
PRIMARY KEY (`value_id`),
|
KEY `field_id` (`field_id`),
|
KEY `case_id` (`case_id`),
|
KEY `party_id` (`party_id`),
|
KEY `FK_USERFIELD_VALUES_OFFICE_ID` (`office_id`),
|
KEY `FK_USERFIELD_VALUES_USER_ID` (`user_id`),
|
KEY `FK_USERFIELD_VALUES_CASE_TEMPLATE_ID` (`case_template_id`),
|
CONSTRAINT `FK_USERFIELD_VALUES_CASE_TEMPLATE_ID` FOREIGN KEY (`case_template_id`) REFERENCES `case_templates` (`case_template_id`) ON DELETE CASCADE ON UPDATE CASCADE,
|
CONSTRAINT `FK_USERFIELD_VALUES_OFFICE_ID` FOREIGN KEY (`office_id`) REFERENCES `offices` (`office_id`) ON DELETE CASCADE ON UPDATE CASCADE,
|
CONSTRAINT `FK_USERFIELD_VALUES_USER_ID` FOREIGN KEY (`user_id`) REFERENCES `users` (`user_id`) ON DELETE CASCADE ON UPDATE CASCADE,
|
CONSTRAINT `userfield_values_ibfk_1` FOREIGN KEY (`field_id`) REFERENCES `userfield_names` (`field_id`) ON DELETE CASCADE ON UPDATE CASCADE,
|
CONSTRAINT `userfield_values_ibfk_2` FOREIGN KEY (`party_id`) REFERENCES `parties` (`party_id`) ON DELETE CASCADE ON UPDATE CASCADE,
|
CONSTRAINT `userfield_values_ibfk_3` FOREIGN KEY (`case_id`) REFERENCES `cases` (`case_id`) ON DELETE CASCADE ON UPDATE CASCADE,
|
CONSTRAINT `only_one_link` CHECK (`party_id` is not null and `case_id` is null and `case_template_id` is null and `user_id` is null and `office_id` is null or `case_id` is not null and `party_id` is null and `case_template_id` is null and `user_id` is null and `office_id` is null or `case_template_id` is not null and `party_id` is null and `case_id` is null and `user_id` is null and `office_id` is null or `user_id` is not null and `party_id` is null and `case_id` is null and `case_template_id` is null and `office_id` is null or `office_id` is not null and `party_id` is null and `case_id` is null and `case_template_id` is null and `user_id` is null)
|
) ENGINE=InnoDB AUTO_INCREMENT=819 DEFAULT CHARSET=utf8mb4;
|
We are experiencing the same bug in our test-pipeline. When using version 10.6.11, we are able to load in our test-database. Using 10.6.12, this is no longer possible.
The specific section of our database-load-script:
Our error-message:
General error: 1901 Function or expression 'party_id' cannot be used in the CHECK clause of `only_one_link`