From 01b279eb80426c5bf1ebebfd1e16829ab3e65429 Mon Sep 17 00:00:00 2001 From: Martin Renvoize Date: Mon, 28 Oct 2019 17:13:09 +0000 Subject: [PATCH] Bug 23805: (RM follow-up) updatedatabase.pl mariadb support MySQL and MariaDB have different syntax when it comes to dropping a CHECK constraint. Signed-off-by: Martin Renvoize --- installer/data/mysql/updatedatabase.pl | 32 +++++++++++++++++++------- 1 file changed, 24 insertions(+), 8 deletions(-) diff --git a/installer/data/mysql/updatedatabase.pl b/installer/data/mysql/updatedatabase.pl index a0c00b43fb..46ac67c426 100755 --- a/installer/data/mysql/updatedatabase.pl +++ b/installer/data/mysql/updatedatabase.pl @@ -20011,14 +20011,30 @@ if ( CheckVersion($DBversion) ) { } # Dropping the check constraint in accountlines - $dbh->do( - qq{ - ALTER TABLE - accountlines - DROP CHECK - `accountlines_check_type` - } - ); + eval { + # MySQL Specific Drop + $dbh->do( + qq{ + ALTER TABLE + accountlines + DROP CHECK + `accountlines_check_type` + } + ); + }; + if ($@) { + # MariaDB Specific Drop + eval { + $dbh->do( + qq{ + ALTER TABLE + accountlines + DROP CONSTRAINT + `accountlines_check_type` + } + ); + }; + } # Update accountype 'C' to 'CREDIT' $dbh->do( -- 2.20.1