From b6a666c4bc2e157e8e88a4c997b5027c408b7c1a Mon Sep 17 00:00:00 2001 From: Martin Renvoize Date: Fri, 8 Nov 2019 10:27:06 +0000 Subject: [PATCH] Bug 23995: Remove CHECK constraints from kohastructure MySQL8 and MariaDB10.3 impliment check constraints but utilise different, incompatible, syntaxes to do so. This patch removes the check constraints entirely whilst we work on a better solution to work around the incompatabilities of the two DBs. Signed-off-by: Martin Renvoize Signed-off-by: Jonathan Druart --- installer/data/mysql/kohastructure.sql | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/installer/data/mysql/kohastructure.sql b/installer/data/mysql/kohastructure.sql index 9a0d45420c..15e13047af 100644 --- a/installer/data/mysql/kohastructure.sql +++ b/installer/data/mysql/kohastructure.sql @@ -2711,8 +2711,7 @@ CREATE TABLE `accountlines` ( CONSTRAINT `accountlines_ibfk_branches` FOREIGN KEY (`branchcode`) REFERENCES `branches` (`branchcode`) ON DELETE SET NULL ON UPDATE CASCADE, CONSTRAINT `accountlines_ibfk_registers` FOREIGN KEY (`register_id`) REFERENCES `cash_registers` (`id`) ON DELETE SET NULL ON UPDATE CASCADE, CONSTRAINT `accountlines_ibfk_credit_type` FOREIGN KEY (`credit_type_code`) REFERENCES `account_credit_types` (`code`) ON DELETE RESTRICT ON UPDATE CASCADE, - CONSTRAINT `accountlines_ibfk_debit_type` FOREIGN KEY (`debit_type_code`) REFERENCES `account_debit_types` (`code`) ON DELETE RESTRICT ON UPDATE CASCADE, - CONSTRAINT `accountlines_check_type` CHECK (`credit_type_code` IS NOT NULL OR `debit_type_code` IS NOT NULL) + CONSTRAINT `accountlines_ibfk_debit_type` FOREIGN KEY (`debit_type_code`) REFERENCES `account_debit_types` (`code`) ON DELETE RESTRICT ON UPDATE CASCADE ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci; -- @@ -3289,7 +3288,6 @@ CREATE TABLE transport_cost ( tobranch varchar(10) NOT NULL, cost decimal(6,2) NOT NULL, disable_transfer tinyint(1) NOT NULL DEFAULT 0, - CHECK ( frombranch <> tobranch ), -- a dud check, mysql does not support that PRIMARY KEY (frombranch, tobranch), CONSTRAINT transport_cost_ibfk_1 FOREIGN KEY (frombranch) REFERENCES branches (branchcode) ON DELETE CASCADE ON UPDATE CASCADE, CONSTRAINT transport_cost_ibfk_2 FOREIGN KEY (tobranch) REFERENCES branches (`branchcode`) ON DELETE CASCADE ON UPDATE CASCADE -- 2.11.0