From 4056568a901dd342f54d0bfccf5c0f897fd7e526 Mon Sep 17 00:00:00 2001 From: Olli-Antti Kivilahti Date: Tue, 12 May 2015 10:19:05 +0300 Subject: [PATCH] Bug 14187 - branchtransfer needs a primary key (id) for DBIx and common sense. --- installer/data/mysql/kohastructure.sql | 2 ++ installer/data/mysql/updatedatabase.pl | 7 +++++++ 2 files changed, 9 insertions(+) diff --git a/installer/data/mysql/kohastructure.sql b/installer/data/mysql/kohastructure.sql index f22aceb..3a934c8 100644 --- a/installer/data/mysql/kohastructure.sql +++ b/installer/data/mysql/kohastructure.sql @@ -439,12 +439,14 @@ CREATE TABLE `branchrelations` ( -- this table links libraries/branches to group DROP TABLE IF EXISTS `branchtransfers`; CREATE TABLE `branchtransfers` ( -- information for items that are in transit between branches + `branchtransfer_id` int(12) NOT NULL auto_increment, -- primary key `itemnumber` int(11) NOT NULL default 0, -- the itemnumber that it is in transit (items.itemnumber) `datesent` datetime default NULL, -- the date the transfer was initialized `frombranch` varchar(10) NOT NULL default '', -- the branch the transfer is coming from `datearrived` datetime default NULL, -- the date the transfer arrived at its destination `tobranch` varchar(10) NOT NULL default '', -- the branch the transfer was going to `comments` mediumtext, -- any comments related to the transfer + PRIMARY KEY (`branchtransfer_id`), KEY `frombranch` (`frombranch`), KEY `tobranch` (`tobranch`), KEY `itemnumber` (`itemnumber`), diff --git a/installer/data/mysql/updatedatabase.pl b/installer/data/mysql/updatedatabase.pl index 3bb3086..2334474 100755 --- a/installer/data/mysql/updatedatabase.pl +++ b/installer/data/mysql/updatedatabase.pl @@ -9875,6 +9875,13 @@ if ( CheckVersion($DBversion) ) { SetVersion($DBversion); } +$DBversion = "3.19.00.XXX"; +if ( CheckVersion($DBversion) ) { + $dbh->do("ALTER TABLE branchtransfers ADD COLUMN branchtransfer_id int(12) NOT NULL auto_increment FIRST, ADD CONSTRAINT PRIMARY KEY (branchtransfer_id);"); + print "Upgrade to $DBversion done (Bug 13743 - Primary key for issues-table)\n"; + SetVersion ($DBversion); +} + $DBversion = "3.19.00.014"; if ( CheckVersion($DBversion) ) { $dbh->do(q| -- 1.7.9.5