From 4e6d62a99e88fafee6155ae42a6d2adfd2897b19 Mon Sep 17 00:00:00 2001 From: Martin Renvoize Date: Fri, 1 Nov 2019 13:09:31 +0000 Subject: [PATCH] Bug 23805: (RM follow-up) Remove CHECK constraints MariaDB and MySQL support different syntaxes for CHECK constraints at different versions. To remove complexities in the updatedatabase script I have opted to remove all CHECK constraints entirely. Signed-off-by: Martin Renvoize https://bugs.koha-community.org/show_bug.cgi?id=23673 --- installer/data/mysql/updatedatabase.pl | 47 -------------------------- 1 file changed, 47 deletions(-) diff --git a/installer/data/mysql/updatedatabase.pl b/installer/data/mysql/updatedatabase.pl index ffd74394b3..d301985be3 100755 --- a/installer/data/mysql/updatedatabase.pl +++ b/installer/data/mysql/updatedatabase.pl @@ -19894,13 +19894,6 @@ if ( CheckVersion($DBversion) ) { ); } - # Adding a check constraints to accountlines - $dbh->do( - qq{ - ALTER TABLE accountlines ADD CONSTRAINT `accountlines_check_type` CHECK (accounttype IS NOT NULL OR debit_type_code IS NOT NULL) - } - ); - # Populating debit_type_code $dbh->do( qq{ @@ -20010,35 +20003,6 @@ if ( CheckVersion($DBversion) ) { ); } - # Dropping the check constraint in accountlines - my ($raise_error) = $dbh->{RaiseError}; - $dbh->{AutoCommit} = 0; - $dbh->{RaiseError} = 1; - eval { - # MariaDB Specific Drop - $dbh->do( - qq{ - ALTER TABLE - accountlines - DROP CONSTRAINT - `accountlines_check_type` - } - ); - }; - if ($@) { - # MySQL Specific Drop - $dbh->do( - qq{ - ALTER TABLE - accountlines - DROP CHECK - `accountlines_check_type` - } - ); - } - $dbh->{AutoCommit} = 1; - $dbh->{RaiseError} = $raise_error; - # Update accountype 'C' to 'CREDIT' $dbh->do( qq{ @@ -20099,17 +20063,6 @@ if ( CheckVersion($DBversion) ) { } ); - # Adding a check constraints to accountlines - $dbh->do( - qq{ - ALTER TABLE - accountlines - ADD CONSTRAINT - `accountlines_check_type` - CHECK (credit_type_code IS NOT NULL OR debit_type_code IS NOT NULL) - } - ); - # Drop accounttype field $dbh->do( qq{ -- 2.17.1