From bfbeafacb9ed318edde09cfb1fa5424d9afca982 Mon Sep 17 00:00:00 2001
From: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Date: Fri, 4 Sep 2020 17:04:53 +0100
Subject: [PATCH] Bug 26268: (QA follow-up) Split DB update checks

This patch splits the DB update such that the 'paidfor' field is checked
for distinctly in the deleteditems table rather than assuming if it
exists in the items table it will also exist in deleteditems.

We also correct the check as highlights by Julian.

Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
---
 installer/data/mysql/atomicupdate/bug_26268.perl | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/installer/data/mysql/atomicupdate/bug_26268.perl b/installer/data/mysql/atomicupdate/bug_26268.perl
index 09790bff21..a5769225e4 100644
--- a/installer/data/mysql/atomicupdate/bug_26268.perl
+++ b/installer/data/mysql/atomicupdate/bug_26268.perl
@@ -1,8 +1,11 @@
 $DBversion = 'XXX'; # will be replaced by the RM
 if( CheckVersion( $DBversion ) ) {
 
-    if( !column_exists( 'items', 'paidfor' ) ) {
+    if( column_exists( 'items', 'paidfor' ) ) {
        $dbh->do(q|ALTER TABLE items DROP COLUMN paidfor|);
+    }
+
+    if ( column_exists( 'deleteditems', 'paidfor' ) ) {
        $dbh->do(q|ALTER TABLE deleteditems DROP COLUMN paidfor|);
     }
 
-- 
2.11.0