[Koha-patches] [PATCH] Change labels.itemnumber type and add print-friendly formatted callnumber field.

Ryan Higgins rch at liblime.com
Fri Apr 4 10:17:45 CEST 2008


---
 installer/data/mysql/kohastructure.sql |    3 ++-
 installer/data/mysql/updatedatabase.pl |    8 ++++++++
 2 files changed, 10 insertions(+), 1 deletions(-)

diff --git a/installer/data/mysql/kohastructure.sql b/installer/data/mysql/kohastructure.sql
index 834bb1f..ffd38ae 100644
--- a/installer/data/mysql/kohastructure.sql
+++ b/installer/data/mysql/kohastructure.sql
@@ -1091,7 +1091,8 @@ DROP TABLE IF EXISTS `labels`;
 CREATE TABLE `labels` (
   `labelid` int(11) NOT NULL auto_increment,
   `batch_id` varchar(10) NOT NULL default 1,
-  `itemnumber` varchar(100) NOT NULL default '',
+  `itemnumber` int(11) NOT NULL,
+  `callnumber` varchar(40) default NULL,
   `timestamp` timestamp NOT NULL default CURRENT_TIMESTAMP on update CURRENT_TIMESTAMP,
   PRIMARY KEY  (`labelid`)
 ) ENGINE=InnoDB DEFAULT CHARSET=utf8;
diff --git a/installer/data/mysql/updatedatabase.pl b/installer/data/mysql/updatedatabase.pl
index b82d9f1..4425e89 100755
--- a/installer/data/mysql/updatedatabase.pl
+++ b/installer/data/mysql/updatedatabase.pl
@@ -1230,6 +1230,14 @@ if (C4::Context->preference("Version") < TransformToNum($DBversion)) {
     SetVersion ($DBversion);
 }
 
+$DBversion = "3.00.00.068";
+if (C4::Context->preference("Version") < TransformToNum($DBversion)) {
+    $dbh->do("ALTER TABLE `labels` MODIFY COLUMN `itemnumber` INT(11) NOT NULL");
+    $dbh->do("ALTER TABLE `labels` ADD COLUMN `callnumber` VARCHAR(40) DEFAULT NULL");
+    print "Upgrade to $DBversion done (Alter labels data type and add print-formatted call number to labels table. ) ";
+    SetVersion ($DBversion);
+}
+
 =item DropAllForeignKeys($table)
 
   Drop all foreign keys of the table $table
-- 
1.5.2.1




More information about the Koha-patches mailing list