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

henridamien.laurent at biblibre.com henridamien.laurent at biblibre.com
Fri Mar 6 11:37:59 CET 2009


From: Nahuel ANGELINETTI <nahuel.angelinetti at biblibre.com>

This patch make a database upgrade, to have an int(11) as a primary unique id, instead of a tinyint(4)(one byte).

Signed-off-by: Henri-Damien LAURENT <henridamien.laurent at biblibre.com>
---
 installer/data/mysql/kohastructure.sql   |    2 +-
 installer/data/mysql/updatedatabase30.pl |    7 +++++++
 kohaversion.pl                           |    2 +-
 3 files changed, 9 insertions(+), 2 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
diff --git a/kohaversion.pl b/kohaversion.pl
index 9250d64..761c687 100644
--- a/kohaversion.pl
+++ b/kohaversion.pl
@@ -10,7 +10,7 @@
 use strict;
 
 sub kohaversion {
-    our $VERSION = '3.00.01.005';
+    our $VERSION = '3.00.01.006';
     # version needs to be set this way
     # so that it can be picked up by Makefile.PL
     # during install
-- 
1.5.6.3




More information about the Koha-patches mailing list