Bug 10443: DBRev 3.13.00.008 - make sure borrower_files exists
authorGalen Charlton <gmc@esilibrary.com>
Fri, 14 Jun 2013 14:50:02 +0000 (07:50 -0700)
committerGalen Charlton <gmc@esilibrary.com>
Fri, 14 Jun 2013 14:53:56 +0000 (07:53 -0700)
This schema update ensures that the borrower_files table
will exist for libraries who first installed Koha at
3.10.x.

Signed-off-by: Galen Charlton <gmc@esilibrary.com>
installer/data/mysql/updatedatabase.pl
kohaversion.pl

index 648e161..5963d24 100755 (executable)
@@ -6990,6 +6990,25 @@ if ( CheckVersion($DBversion) ) {
     SetVersion($DBversion);
 }
 
+$DBversion = "3.13.00.008";
+if ( CheckVersion($DBversion) ) {
+    $dbh->do("
+CREATE TABLE IF NOT EXISTS borrower_files (
+  file_id int(11) NOT NULL AUTO_INCREMENT,
+  borrowernumber int(11) NOT NULL,
+  file_name varchar(255) NOT NULL,
+  file_type varchar(255) NOT NULL,
+  file_description varchar(255) DEFAULT NULL,
+  file_content longblob NOT NULL,
+  date_uploaded timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
+  PRIMARY KEY (file_id),
+  KEY borrowernumber (borrowernumber),
+  CONSTRAINT borrower_files_ibfk_1 FOREIGN KEY (borrowernumber) REFERENCES borrowers (borrowernumber) ON DELETE CASCADE ON UPDATE CASCADE
+) ENGINE=InnoDB  DEFAULT CHARSET=utf8;
+    ");
+    print "Upgrade to $DBversion done (Bug 10443: make sure borrower_files table exists)\n";
+    SetVersion($DBversion);
+}
 
 =head1 FUNCTIONS
 
index d637b22..71938e4 100644 (file)
@@ -16,7 +16,7 @@ the kohaversion is divided in 4 parts :
 use strict;
 
 sub kohaversion {
-    our $VERSION = '3.13.00.007';
+    our $VERSION = '3.13.00.008';
     # version needs to be set this way
     # so that it can be picked up by Makefile.PL
     # during install