Permalink
Browse files

PT16549719: Fatal error saving default item settings

Database schema needed to be restructured. New column session_defaults_id
was added and made the primary key.
  • Loading branch information...
1 parent 5978daa commit 242958b01af0c519b6601413dddcc93d5cc525a4 @dlbptfs dlbptfs committed Sep 21, 2011
Showing with 12 additions and 3 deletions.
  1. +1 −1 C4/Context.pm
  2. +2 −1 installer/data/mysql/kohastructure.sql
  3. +8 −0 installer/data/mysql/updatedatabase.pl
  4. +1 −1 kohaversion.pl
View
@@ -32,7 +32,7 @@ use POSIX ();
use JSON qw(from_json);
use Koha;
-$VERSION = '4.07.00.001';
+$VERSION = '4.08.00.002';
die "Version mismatch: $VERSION > $Koha::VERSION" if ($VERSION gt $Koha::VERSION);
@@ -2720,11 +2720,12 @@ CREATE TABLE import_profile_subfield_actions (
DROP TABLE IF EXISTS `session_defaults`;
CREATE TABLE `session_defaults` (
+ `session_defaults_id` int(11) NOT NULL auto_increment,
`branchcode` varchar(10) NOT NULL,
`name` varchar(32) NOT NULL,
`key` varchar(32) NOT NULL,
`value` text,
- PRIMARY KEY (`branchcode`,`name`),
+ PRIMARY KEY (`session_defaults_id`),
CONSTRAINT `session_defaults_ibfk_1` FOREIGN KEY (`branchcode`) REFERENCES `branches` (`branchcode`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
@@ -4688,6 +4688,14 @@
print "Upgrade to $DBversion done ( Allow lost_items.itemtype to be nullable )\n";
}
+$DBversion = '4.08.00.002';
+if (C4::Context->preference("Version") < TransformToNum($DBversion)) {
+ $dbh->do('ALTER TABLE session_defaults DROP PRIMARY KEY');
+ $dbh->do('ALTER TABLE session_defaults ADD COLUMN session_defaults_id int(11) PRIMARY KEY AUTO_INCREMENT FIRST');
+ SetVersion ($DBversion);
+ print "Upgrade to $DBversion done ( Add session_defaults_id to sesstion defaults table and make it the primary key )\n";
+}
+
printf "Database schema now up to date at version %s as of %s.\n", $DBversion, scalar localtime;
=item DropAllForeignKeys($table)
View
@@ -10,7 +10,7 @@
use strict;
sub kohaversion {
- our $VERSION = '4.07.00.001';
+ our $VERSION = '4.08.00.002';
# version needs to be set this way
# so that it can be picked up by Makefile.PL
# during install

0 comments on commit 242958b

Please sign in to comment.