From bceaadb9130c6850d1e0c95bad8ff9d68e69c2f7 Mon Sep 17 00:00:00 2001 From: Bernardo Gonzalez Kriegel Date: Sat, 13 Jul 2013 10:58:26 -0300 Subject: [PATCH] Bug 10443: DBRev 3.10.07.001 - make sure borrower_files exists This schema update ensures that the borrower_files table will exist for libraries who first installed Koha at 3.10.x. Signed-off-by: Bernardo Gonzalez Kriegel --- installer/data/mysql/updatedatabase.pl | 20 ++++++++++++++++++++ kohaversion.pl | 2 +- 2 files changed, 21 insertions(+), 1 deletion(-) diff --git a/installer/data/mysql/updatedatabase.pl b/installer/data/mysql/updatedatabase.pl index 9bb7016c50..c6d7939857 100755 --- a/installer/data/mysql/updatedatabase.pl +++ b/installer/data/mysql/updatedatabase.pl @@ -6271,6 +6271,26 @@ if ( C4::Context->preference("Version") < TransformToNum($DBversion) ) { SetVersion($DBversion); } +$DBversion = "3.10.07.001"; +if ( C4::Context->preference("Version") < TransformToNum($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 =head2 TableExists($table) diff --git a/kohaversion.pl b/kohaversion.pl index e4a4c93751..e4d287ee23 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.10.07.000'; + our $VERSION = '3.10.07.001'; # version needs to be set this way # so that it can be picked up by Makefile.PL # during install -- 2.39.5