From 415806a14321f54c8cc5e7e1554933730418b74e Mon Sep 17 00:00:00 2001 From: Fridolin Somers Date: Mon, 29 Dec 2014 17:35:26 +0100 Subject: [PATCH] Bug 9351 - sql update on existing statistics Signed-off-by: Kyle M Hall Signed-off-by: Nick --- installer/data/mysql/updatedatabase.pl | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) diff --git a/installer/data/mysql/updatedatabase.pl b/installer/data/mysql/updatedatabase.pl index 1dd8c0b..05f1421 100755 --- a/installer/data/mysql/updatedatabase.pl +++ b/installer/data/mysql/updatedatabase.pl @@ -10462,6 +10462,29 @@ if ( CheckVersion($DBversion) ) { SetVersion ($DBversion); } + +$DBversion = "3.21.00.XXX"; +if ( CheckVersion($DBversion) ) { + $dbh->do(q{ + UPDATE statistics + SET itemtype = + ( + SELECT u.itype FROM + ( + SELECT itype,itemnumber FROM items + UNION ALL + SELECT itype,itemnumber FROM deleteditems + ) u + WHERE statistics.itemnumber = u.itemnumber + LIMIT 1 + ) + WHERE type IN ('localuse', 'return') + }); + print "upgrade to $DBversion done (Bug 9351 - item type not recorded correctly in statistics for returns and some local use)\n"; + SetVersion ($DBversion); +} + + # DEVELOPER PROCESS, search for anything to execute in the db_update directory # SEE bug 13068 # if there is anything in the atomicupdate, read and execute it. -- 1.9.1