[Koha-patches] [PATCH] [SIGNED-OFF 1/7] Bug 5422: Separate state field for patron's addresses - database update

Magnus Enger magnus at enger.priv.no
Thu Apr 7 11:41:30 CEST 2011


From: Katrin Fischer <Katrin.Fischer.83 at web.de>


Signed-off-by: Magnus Enger <magnus at enger.priv.no>
---
 installer/data/mysql/kohastructure.sql |    3 +++
 installer/data/mysql/updatedatabase.pl |   12 ++++++++++++
 kohaversion.pl                         |    2 +-
 3 files changed, 16 insertions(+), 1 deletions(-)

diff --git a/installer/data/mysql/kohastructure.sql b/installer/data/mysql/kohastructure.sql
index 9148970..ea0bc03 100644
--- a/installer/data/mysql/kohastructure.sql
+++ b/installer/data/mysql/kohastructure.sql
@@ -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,
diff --git a/installer/data/mysql/updatedatabase.pl b/installer/data/mysql/updatedatabase.pl
index d093946..6019ed8 100755
--- a/installer/data/mysql/updatedatabase.pl
+++ b/installer/data/mysql/updatedatabase.pl
@@ -3876,6 +3876,18 @@ VALUES
     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)
diff --git a/kohaversion.pl b/kohaversion.pl
index 53c1724..8330459 100644
--- a/kohaversion.pl
+++ b/kohaversion.pl
@@ -16,7 +16,7 @@ the kohaversion is divided in 4 parts :
 use strict;
 
 sub kohaversion {
-    our $VERSION = '3.03.00.004';
+    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
-- 
1.7.1



More information about the Koha-patches mailing list