[PATCH 1/3] Database structure modification.

Sébastien Hinderer Sebastien.Hinderer at ens-lyon.org
Fri Jul 24 11:00:07 CEST 2009


Adds 5 columns to the `branches` table: `branchzip`, `branchcity`,
`branchcountry`, `branchurlè` and `branchnote`.
I/O operations for these fields are not included.
---
 installer/data/Pg/kohastructure.sql    |    7 ++++++-
 installer/data/mysql/kohastructure.sql |    5 +++++
 installer/data/mysql/updatedatabase.pl |   19 +++++++++++++++++++
 3 files changed, 30 insertions(+), 1 deletions(-)

diff --git a/installer/data/Pg/kohastructure.sql b/installer/data/Pg/kohastructure.sql
index 9243ad5..8c444fe 100644
--- a/installer/data/Pg/kohastructure.sql
+++ b/installer/data/Pg/kohastructure.sql
@@ -540,12 +540,17 @@ branchname text NOT NULL,
 branchaddress1 text,
 branchaddress2 text,
 branchaddress3 text,
+branchzip varchar(25) default NULL,  
+branchcity mediumtext,
+branchcountry text,
 branchphone text,
 branchfax text,
 branchemail text,
+branchurl mediumtext,
 issuing int default NULL,
 branchip varchar(15) default NULL,
-branchprinter varchar(100) default NULL
+branchprinter varchar(100) default NULL,
+branchnotes mediumtext
 );
 
 -- 
diff --git a/installer/data/mysql/kohastructure.sql b/installer/data/mysql/kohastructure.sql
index 2b2e0c9..591ab58 100644
--- a/installer/data/mysql/kohastructure.sql
+++ b/installer/data/mysql/kohastructure.sql
@@ -569,12 +569,17 @@ CREATE TABLE `branches` (
   `branchaddress1` mediumtext,
   `branchaddress2` mediumtext,
   `branchaddress3` mediumtext,
+  `branchzip` varchar(25) default NULL,  
+  `branchcity` mediumtext,
+  `branchcountry` text,
   `branchphone` mediumtext,
   `branchfax` mediumtext,
   `branchemail` mediumtext,
+  `branchurl` mediumtext,
   `issuing` tinyint(4) default NULL,
   `branchip` varchar(15) default NULL,
   `branchprinter` varchar(100) default NULL,
+  `branchnotes` mediumtext,
   UNIQUE KEY `branchcode` (`branchcode`)
 ) ENGINE=InnoDB DEFAULT CHARSET=utf8;
 
diff --git a/installer/data/mysql/updatedatabase.pl b/installer/data/mysql/updatedatabase.pl
index 58497c8..ea126f8 100755
--- a/installer/data/mysql/updatedatabase.pl
+++ b/installer/data/mysql/updatedatabase.pl
@@ -2467,6 +2467,25 @@ if (C4::Context->preference("Version") < TransformToNum($DBversion)) {
     print "Upgrade to $DBversion done (added FilterBeforeOverdueReport syspref and new index on authorised_values)\n";
 }
 
+=item
+
+    Deal with branches
+
+=cut
+
+my $DBversion = "3.01.00.038";
+if (C4::Context->preference("Version") < TransformToNum($DBversion)) {
+    # update branches table
+    # 
+    $dbh->do("ALTER TABLE branches ADD `branchzip` varchar(25) default NULL AFTER `branchaddress3`");
+    $dbh->do("ALTER TABLE branches ADD `branchcity` mediumtext AFTER `branchzip`");
+    $dbh->do("ALTER TABLE branches ADD `branchcountry` text AFTER `branchcity`");
+    $dbh->do("ALTER TABLE branches ADD `branchurl` mediumtext AFTER `branchemail`");
+    $dbh->do("ALTER TABLE branches ADD `branchnotes` mediumtext AFTER `branchprinter`");
+    print "Upgrade to $DBversion done (branches)\n";
+    SetVersion ($DBversion);
+}
+
 =item DropAllForeignKeys($table)
 
   Drop all foreign keys of the table $table
-- 
1.6.3.3


--PNTmBPCT7hxwcZjr
Content-Type: text/x-diff; charset=us-ascii
Content-Disposition: attachment; filename="0002-C4-Branch.pm-the-branch-zip-city-country-url-notes-r.patch"



More information about the Koha-patches mailing list