From b0cd79cfafede1411db17edfbf1e4bca43ad2251 Mon Sep 17 00:00:00 2001 From: Josef Moravec Date: Wed, 20 Mar 2019 15:26:38 +0000 Subject: [PATCH] Bug 13795: Make database update idempotent Signed-off-by: Michal Denar Signed-off-by: Michal Denar Signed-off-by: Katrin Fischer --- .../mysql/atomicupdate/Bug13795_Remove_unused_columns.perl | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/installer/data/mysql/atomicupdate/Bug13795_Remove_unused_columns.perl b/installer/data/mysql/atomicupdate/Bug13795_Remove_unused_columns.perl index 51e223eab7..71c7604afc 100644 --- a/installer/data/mysql/atomicupdate/Bug13795_Remove_unused_columns.perl +++ b/installer/data/mysql/atomicupdate/Bug13795_Remove_unused_columns.perl @@ -1,12 +1,12 @@ $DBversion = 'XXX'; # will be replaced by the RM if( CheckVersion( $DBversion ) ) { - $dbh->do(q{ - ALTER TABLE statistics - DROP COLUMN associatedborrower - DROP COLUMN usercode - }); + if( column_exists('statistics', 'associatedborrower') ) { + $dbh->do(q{ ALTER TABLE statistics DROP COLUMN associatedborrower }); + } + if( column_exists('statistics', 'usercode') ) { + $dbh->do(q{ ALTER TABLE statistics DROP COLUMN usercode }); + } SetVersion($DBversion); - print "Upgrade to $DBversion done (Bug 13795 - Delete unused fields from statistics table)\n"; } -- 2.11.0