From 0df4c6a3ace12caed5e1ed421bdf2da643901b96 Mon Sep 17 00:00:00 2001 From: MJ Ray Date: Thu, 5 Apr 2012 18:56:39 +0100 Subject: [PATCH] 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 | 9 +++++++-- 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/installer/data/mysql/kohastructure.sql b/installer/data/mysql/kohastructure.sql index 40f5969467..03911fe514 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 a3fd90e819..b3c569190a 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,7 +5145,6 @@ if ( C4::Context->preference("Version") < TransformToNum($DBversion) ) { SetVersion($DBversion); } - $DBversion = "3.07.00.045"; if (C4::Context->preference("Version") < TransformToNum($DBversion)) { $dbh->do("ALTER TABLE import_batches MODIFY COLUMN batch_type ENUM('batch','z3950','webservice') NOT NULL default 'batch'"); @@ -5154,6 +5152,13 @@ if (C4::Context->preference("Version") < TransformToNum($DBversion)) { SetVersion ($DBversion); } +$DBversion = "3.07.00.046"; +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) -- 2.39.5