[PATCH 1/3] Database structure modification.

Sébastien Hinderer Sebastien.Hinderer at ens-lyon.org
Sat Aug 1 13:05:55 CEST 2009


Adds the country and B_country columns to the borrowers table.
---
 installer/data/Pg/kohastructure.sql    |    2 ++
 installer/data/mysql/kohastructure.sql |    2 ++
 installer/data/mysql/updatedatabase.pl |   16 ++++++++++++++++
 3 files changed, 20 insertions(+), 0 deletions(-)

diff --git a/installer/data/Pg/kohastructure.sql b/installer/data/Pg/kohastructure.sql
index 8c444fe..69abd24 100644
--- a/installer/data/Pg/kohastructure.sql
+++ b/installer/data/Pg/kohastructure.sql
@@ -473,6 +473,7 @@ address text NOT NULL,
 address2 text,
 city text NOT NULL,
 zipcode varchar(25) default NULL,
+country text,
 email text,
 phone text,
 mobile varchar(50) default NULL,
@@ -484,6 +485,7 @@ B_streettype varchar(50) default NULL,
 B_address varchar(100) default NULL,
 B_city text,
 B_zipcode varchar(25) default NULL,
+B_country text,
 B_email text,
 B_phone text,
 dateofbirth date default NULL,
diff --git a/installer/data/mysql/kohastructure.sql b/installer/data/mysql/kohastructure.sql
index 591ab58..fe71e4f 100644
--- a/installer/data/mysql/kohastructure.sql
+++ b/installer/data/mysql/kohastructure.sql
@@ -444,6 +444,7 @@ CREATE TABLE `borrowers` (
   `address2` text,
   `city` mediumtext NOT NULL,
   `zipcode` varchar(25) default NULL,
+  `country` text,
   `email` mediumtext,
   `phone` text,
   `mobile` varchar(50) default NULL,
@@ -455,6 +456,7 @@ CREATE TABLE `borrowers` (
   `B_address` varchar(100) default NULL,
   `B_city` mediumtext,
   `B_zipcode` varchar(25) default NULL,
+  `B_country` text,
   `B_email` text,
   `B_phone` mediumtext,
   `dateofbirth` date default NULL,
diff --git a/installer/data/mysql/updatedatabase.pl b/installer/data/mysql/updatedatabase.pl
index d6ccd0a..902227b 100755
--- a/installer/data/mysql/updatedatabase.pl
+++ b/installer/data/mysql/updatedatabase.pl
@@ -2480,6 +2480,22 @@ if (C4::Context->preference("Version") < TransformToNum($DBversion)) {
     SetVersion ($DBversion);
 }
 
+=item
+
+    Deal with borrowers
+
+=cut
+
+$DBversion = "3.01.00.039";
+if (C4::Context->preference("Version") < TransformToNum($DBversion)) {
+    # update borrowers table
+    # 
+    $dbh->do("ALTER TABLE borrowers ADD `country` text AFTER zipcode");
+    $dbh->do("ALTER TABLE borrowers ADD `B_country` text AFTER B_zipcode");
+    print "Upgrade to $DBversion done (branches)\n";
+    SetVersion ($DBversion);
+}
+
 =item DropAllForeignKeys($table)
 
   Drop all foreign keys of the table $table
-- 
1.6.3.3


--r5Pyd7+fXNt84Ff3
Content-Type: text/x-diff; charset=us-ascii
Content-Disposition: attachment; filename="0002-Takes-columns-country-and-B_country-of-table-borrowe.patch"



More information about the Koha-patches mailing list