From 9a6b6895a59d7bfc80910263b6c4cbb99a1d3741 Mon Sep 17 00:00:00 2001 From: Mark Tompsett Date: Mon, 29 Oct 2018 17:10:01 +0000 Subject: [PATCH] Bug 21682: Follow up to use the default_exists check This will make sure it is idempotent, and avoid issues if the DB has already been corrected either through upgrade or manually before. --- installer/data/mysql/atomicupdate/bug_21682.perl | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/installer/data/mysql/atomicupdate/bug_21682.perl b/installer/data/mysql/atomicupdate/bug_21682.perl index 16eeb3d80b..69ce30587e 100644 --- a/installer/data/mysql/atomicupdate/bug_21682.perl +++ b/installer/data/mysql/atomicupdate/bug_21682.perl @@ -1,6 +1,10 @@ $DBversion = 'XXX'; # will be replaced by the RM if( CheckVersion( $DBversion ) ) { - $dbh->do( "ALTER TABLE `stockrotationrotas` ALTER COLUMN `description` DROP DEFAULT" ); + # people upgrading their MySQL/MariaDB will have already had the DB forcibly fixed, + # but for those who have not, and there is a sql strict mode issue, this will fix it. + if ( default_exists( 'stockrotationrotas', 'description' ) ) { + $dbh->do( "ALTER TABLE `stockrotationrotas` ALTER COLUMN `description` DROP DEFAULT" ); + } SetVersion( $DBversion ); print "Upgrade to $DBversion done (Bug 21682 - Remove default on stockrotationrotas.description )\n"; -- 2.11.0