bug 5549: change to kohastructure.sql missing from commit 8cea8e5cc05075dc391194248d3...
authorMJ Ray <mjr@phonecoop.coop>
Thu, 5 Apr 2012 17:56:39 +0000 (18:56 +0100)
committerPaul Poulain <paul.poulain@biblibre.com>
Fri, 6 Apr 2012 15:58:28 +0000 (17:58 +0200)
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 <Katrin.Fischer.83@web.de>
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
installer/data/mysql/updatedatabase.pl

index 40f5969..03911fe 100644 (file)
@@ -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",
index a3fd90e..b3c5691 100755 (executable)
@@ -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)