From fd6f653d8eb9383034c36ba6f430369ee0be7293 Mon Sep 17 00:00:00 2001 From: Kyle M Hall Date: Fri, 5 Feb 2010 15:29:36 +0000 Subject: [PATCH] Bugfix 4118 - Add Collection Code to Statistics Table - DB Update --- installer/data/mysql/updatedatabase.pl | 15 +++++++++++++++ 1 files changed, 15 insertions(+), 0 deletions(-) diff --git a/installer/data/mysql/updatedatabase.pl b/installer/data/mysql/updatedatabase.pl index 62b4372..d1a3c72 100755 --- a/installer/data/mysql/updatedatabase.pl +++ b/installer/data/mysql/updatedatabase.pl @@ -5343,6 +5343,18 @@ if ( C4::Context->preference("Version") < TransformToNum($DBversion) ) { SetVersion($DBversion); } +$DBversion = '3.09.00.XXX'; +if (C4::Context->preference("Version") < TransformToNum($DBversion)) { + $dbh->do("ALTER TABLE `statistics` ADD `ccode` VARCHAR( 80 ) NULL ;"); + $dbh->do("UPDATE statistics SET statistics.ccode = ( SELECT items.ccode FROM items WHERE statistics.itemnumber = items.itemnumber )"); + $dbh->do("UPDATE statistics SET statistics.ccode = ( + SELECT deleteditems.ccode FROM deleteditems + WHERE statistics.itemnumber = deleteditems.itemnumber + ) WHERE statistics.ccode IS NULL"); + print "Upgrade done ( Added Category Code to Statistics table. )\n"; + SetVersion ($DBversion); +} + =head1 FUNCTIONS =head2 TableExists($table) @@ -5362,6 +5374,9 @@ sub TableExists { =head2 DropAllForeignKeys($table) + +=item DropAllForeignKeys($table) + Drop all foreign keys of the table $table =cut -- 1.7.2.5