From f7325a6ed70fab67576eb0b5a74314d6a6191372 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 --- 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.39.5