Bug 5422: Separate state field for patron's addresses - database update
authorKatrin Fischer <Katrin.Fischer.83@web.de>
Thu, 7 Apr 2011 09:41:30 +0000 (11:41 +0200)
committerChris Cormack <chrisc@catalyst.net.nz>
Fri, 8 Apr 2011 23:49:27 +0000 (11:49 +1200)
Signed-off-by: Magnus Enger <magnus@enger.priv.no>
Signed-off-by: Chris Cormack <chrisc@catalyst.net.nz>
installer/data/mysql/kohastructure.sql
installer/data/mysql/updatedatabase.pl
kohaversion.pl

index 28dd5a6..478afd6 100644 (file)
@@ -206,6 +206,7 @@ CREATE TABLE `borrowers` (
   `address` mediumtext NOT NULL,
   `address2` text,
   `city` mediumtext NOT NULL,
+  `state` mediumtext default NULL,
   `zipcode` varchar(25) default NULL,
   `country` text,
   `email` mediumtext,
@@ -219,6 +220,7 @@ CREATE TABLE `borrowers` (
   `B_address` varchar(100) default NULL,
   `B_address2` text default NULL,
   `B_city` mediumtext,
+  `B_state` mediumtext default NULL,
   `B_zipcode` varchar(25) default NULL,
   `B_country` text,
   `B_email` text,
@@ -252,6 +254,7 @@ CREATE TABLE `borrowers` (
   `altcontactaddress1` varchar(255) default NULL,
   `altcontactaddress2` varchar(255) default NULL,
   `altcontactaddress3` varchar(255) default NULL,
+  `altcontactstate` mediumtext default NULL,
   `altcontactzipcode` varchar(50) default NULL,
   `altcontactcountry` text default NULL,
   `altcontactphone` varchar(50) default NULL,
index 7f76078..b42b6ed 100755 (executable)
@@ -4259,6 +4259,18 @@ if ( C4::Context->preference("Version") < TransformToNum($DBversion) ) {
     SetVersion($DBversion);
 }
 
+$DBversion = '3.03.00.XXX';
+if (C4::Context->preference("Version") < TransformToNum($DBversion)) {
+    $dbh->do("ALTER TABLE borrowers ADD `state` mediumtext AFTER city;");
+    $dbh->do("ALTER TABLE borrowers ADD `B_state` mediumtext AFTER B_city;");
+    $dbh->do("ALTER TABLE borrowers ADD `altcontactstate` mediumtext AFTER altcontactaddress3;");
+    $dbh->do("ALTER TABLE deletedborrowers ADD `state` mediumtext AFTER city;");
+    $dbh->do("ALTER TABLE deletedborrowers ADD `B_state` mediumtext AFTER B_city;");
+    $dbh->do("ALTER TABLE deletedborrowers ADD `altcontactstate` mediumtext AFTER altcontactaddress3;");
+    print "Upgrade to $DBversion done (Add state field to patron's addresses)\n";
+    SetVersion ($DBversion);
+}
+
 =head1 FUNCTIONS
 
 =head2 DropAllForeignKeys($table)
index 6b33ee0..8330459 100644 (file)
@@ -16,7 +16,7 @@ the kohaversion is divided in 4 parts :
 use strict;
 
 sub kohaversion {
-    our $VERSION = '3.03.00.046';
+    our $VERSION = '3.03.00.XXX';
     # version needs to be set this way
     # so that it can be picked up by Makefile.PL
     # during install