From 5d5545308f963693abaeda9f73c850cb7ad7f7a2 Mon Sep 17 00:00:00 2001 From: MJ Ray Date: Thu, 5 Apr 2012 18:56:39 +0100 Subject: [PATCH] [SIGNED-OFF] bug 5549: change to kohastructure.sql missing from commit 8cea8e5cc05075dc391194248d31a54586389601 Also deletes earlier updatedatabase addition of lengthunit to avoid errors for people upgrading from stable (thanks Katrin for the idea) Signed-off-by: Katrin Fischer Checked creating a database from scratch and updating a database with missing lengthunit column. Both worked without any problem. If you update and have the column updatedatabase will report an error, but the database will be ok. --- installer/data/mysql/kohastructure.sql | 1 + installer/data/mysql/updatedatabase.pl | 11 ++++++++++- 2 files changed, 11 insertions(+), 1 deletions(-) diff --git a/installer/data/mysql/kohastructure.sql b/installer/data/mysql/kohastructure.sql index 4912e19..b85ab5f 100644 --- a/installer/data/mysql/kohastructure.sql +++ b/installer/data/mysql/kohastructure.sql @@ -990,6 +990,7 @@ CREATE TABLE `issuingrules` ( `chargename` varchar(100) default NULL, `maxissueqty` int(4) default NULL, `issuelength` int(4) default NULL, + `lengthunit` varchar(10) default 'days', `hardduedate` date default NULL, `hardduedatecompare` tinyint NOT NULL default "0", `renewalsallowed` smallint(6) NOT NULL default "0", diff --git a/installer/data/mysql/updatedatabase.pl b/installer/data/mysql/updatedatabase.pl index 503c8ee..f7ff929 100755 --- a/installer/data/mysql/updatedatabase.pl +++ b/installer/data/mysql/updatedatabase.pl @@ -5019,7 +5019,6 @@ if ( C4::Context->preference("Version") < TransformToNum($DBversion) ) { $dbh->do("ALTER TABLE old_issues CHANGE returndate returndate datetime"); $dbh->do("ALTER TABLE old_issues CHANGE lastreneweddate lastreneweddate datetime"); $dbh->do("ALTER TABLE old_issues CHANGE issuedate issuedate datetime"); - $dbh->do("alter table issuingrules add column lengthunit varchar(10) default 'days' after issuelength"); print "Upgrade to $DBversion done (Setting up issues tables for hourly loans)\n"; SetVersion($DBversion); } @@ -5146,6 +5145,16 @@ if ( C4::Context->preference("Version") < TransformToNum($DBversion) ) { SetVersion($DBversion); } + + +$DBversion = "3.07.00.XXX"; +if ( C4::Context->preference("Version") < TransformToNum($DBversion) ) { + $dbh->do("alter table issuingrules add column lengthunit varchar(10) default 'days' after issuelength"); + print "Upgrade to $DBversion done (Setting up issues tables for hourly loans (lengthunit fix))\n"; + SetVersion($DBversion); +} + + =head1 FUNCTIONS =head2 DropAllForeignKeys($table) -- 1.7.5.4