[Koha-patches] [PATCH] [3.0.x] (bug #2948) change the aqbudgetid column type

Nahuel ANGELINETTI nahuel.angelinetti at biblibre.com
Fri Feb 6 14:57:07 CET 2009


This patch make a database upgrade, to have an int(11) as a primary unique id, instead of a tinyint(4)(one byte).
---
 installer/data/mysql/kohastructure.sql   |    2 +-
 installer/data/mysql/updatedatabase30.pl |    7 +++++++
 2 files changed, 8 insertions(+), 1 deletions(-)

diff --git a/installer/data/mysql/kohastructure.sql b/installer/data/mysql/kohastructure.sql
index c8d00c4..230bff0 100644
--- a/installer/data/mysql/kohastructure.sql
+++ b/installer/data/mysql/kohastructure.sql
@@ -177,7 +177,7 @@ CREATE TABLE `aqbudget` (
   `startdate` date NOT NULL default 0,
   `enddate` date default NULL,
   `budgetamount` decimal(13,2) default NULL,
-  `aqbudgetid` tinyint(4) NOT NULL auto_increment,
+  `aqbudgetid` int(11) NOT NULL auto_increment,
   `branchcode` varchar(10) default NULL,
   PRIMARY KEY  (`aqbudgetid`)
 ) ENGINE=InnoDB DEFAULT CHARSET=utf8;
diff --git a/installer/data/mysql/updatedatabase30.pl b/installer/data/mysql/updatedatabase30.pl
index dd17158..e6fda8b 100644
--- a/installer/data/mysql/updatedatabase30.pl
+++ b/installer/data/mysql/updatedatabase30.pl
@@ -155,6 +155,13 @@ if (C4::Context->preference("Version") < TransformToNum($DBversion)) {
     SetVersion ($DBversion);
 }
 
+$DBversion = "3.00.01.006";
+if (C4::Context->preference("Version") < TransformToNum($DBversion)) {
+    $dbh->do("ALTER TABLE `aqbudget` CHANGE `aqbudgetid` `aqbudgetid` INT( 11 ) NOT NULL AUTO_INCREMENT");
+    print "Upgrade to $DBversion done (Change the field)\n";
+    SetVersion ($DBversion);
+}
+
 =item DropAllForeignKeys($table)
 
   Drop all foreign keys of the table $table
-- 
1.5.6.3




More information about the Koha-patches mailing list