[Koha-patches] [PATCH] kohabug 2934 - Wrong datatype causes artificial limit to label batch id's
Chris Nighswonger
cnighswonger at foundations.edu
Thu Jan 29 11:07:09 CET 2009
labels.batch_id should be int as the value is always an integer. This corrects
the problem.
I'm submitting a patch for this built against the current 3.0.x branch. It
should be ported forward to the current 3.1 branch as well.
---
installer/data/mysql/kohastructure.sql | 2 +-
installer/data/mysql/updatedatabase.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 53da4fe..9e95458 100644
--- a/installer/data/mysql/kohastructure.sql
+++ b/installer/data/mysql/kohastructure.sql
@@ -1171,7 +1171,7 @@ CREATE TABLE `itemtypes` (
DROP TABLE IF EXISTS `labels`;
CREATE TABLE `labels` (
`labelid` int(11) NOT NULL auto_increment,
- `batch_id` varchar(10) NOT NULL default 1,
+ `batch_id` int(10) NOT NULL default 1,
`itemnumber` varchar(100) NOT NULL default '',
`timestamp` timestamp NOT NULL default CURRENT_TIMESTAMP on update CURRENT_TIMESTAMP,
PRIMARY KEY (`labelid`)
diff --git a/installer/data/mysql/updatedatabase.pl b/installer/data/mysql/updatedatabase.pl
index c200878..7b8de69 100755
--- a/installer/data/mysql/updatedatabase.pl
+++ b/installer/data/mysql/updatedatabase.pl
@@ -1937,6 +1937,13 @@ if (C4::Context->preference("Version") < TransformToNum($DBversion)) {
SetVersion ($DBversion);
}
+$DBversion = "3.00.00.107";
+if (C4::Context->preference("Version") < TransformToNum($DBversion)) {
+ $dbh->do("ALTER TABLE labels MODIFY COLUMN batch_id int(10) NOT NULL default 1;");
+ print "Upgrade to $DBversion done (change labels.batch_id from varchar to int)\n";
+ SetVersion ($DBversion);
+}
+
=item DropAllForeignKeys($table)
Drop all foreign keys of the table $table
diff --git a/kohaversion.pl b/kohaversion.pl
index d8cfb9b..582aa2c 100644
--- a/kohaversion.pl
+++ b/kohaversion.pl
@@ -10,7 +10,7 @@
use strict;
sub kohaversion {
- our $VERSION = '3.00.00.106';
+ our $VERSION = '3.00.00.107';
# version needs to be set this way
# so that it can be picked up by Makefile.PL
# during install
--
1.5.3.7
More information about the Koha-patches
mailing list