From 838269d1e79b9f27ed65e04593e36cd9513b4787 Mon Sep 17 00:00:00 2001 From: Paul Poulain Date: Mon, 28 May 2012 11:59:44 +0200 Subject: [PATCH] Bug 7792:redefine the field branchcode as PRIMARY KEY of branches Signed-off-by: Jared Camins-Esakov --- installer/data/mysql/kohastructure.sql | 2 +- installer/data/mysql/updatedatabase.pl | 10 ++++++++-- 2 files changed, 9 insertions(+), 3 deletions(-) diff --git a/installer/data/mysql/kohastructure.sql b/installer/data/mysql/kohastructure.sql index 8b1ab22a08..12ea9d1dbc 100644 --- a/installer/data/mysql/kohastructure.sql +++ b/installer/data/mysql/kohastructure.sql @@ -365,7 +365,7 @@ CREATE TABLE `branches` ( -- information about your libraries or branches are st `branchprinter` varchar(100) default NULL, -- unused in Koha `branchnotes` mediumtext, -- notes related to your library or branch opac_info text, -- HTML that displays in OPAC - UNIQUE KEY `branchcode` (`branchcode`) + PRIMARY KEY (`branchcode`) ) ENGINE=InnoDB DEFAULT CHARSET=utf8; -- diff --git a/installer/data/mysql/updatedatabase.pl b/installer/data/mysql/updatedatabase.pl index c801f00726..51a6486132 100755 --- a/installer/data/mysql/updatedatabase.pl +++ b/installer/data/mysql/updatedatabase.pl @@ -5269,8 +5269,6 @@ if ( C4::Context->preference("Version") < TransformToNum($DBversion) ) { SetVersion($DBversion); } - - $DBversion = "3.09.00.006"; if ( C4::Context->preference("Version") < TransformToNum($DBversion) ) { $dbh->do("UPDATE systempreferences SET @@ -5298,6 +5296,14 @@ if (C4::Context->preference("Version") < TransformToNum($DBversion)) { $dbh->do("ALTER TABLE sessions ADD PRIMARY KEY (id);"); $dbh->do("ALTER TABLE sessions DROP INDEX `id`;"); print "Upgrade to $DBversion done (redefine the field id as PRIMARY KEY of sessions)\n"; + SetVersion($DBversion); +} + +$DBversion = "3.09.00.009"; +if (C4::Context->preference("Version") < TransformToNum($DBversion)) { + $dbh->do("ALTER TABLE branches ADD PRIMARY KEY (branchcode);"); + $dbh->do("ALTER TABLE branches DROP INDEX branchcode;"); + print "Upgrade to $DBversion done (redefine the field branchcode as PRIMARY KEY of branches)\n"; SetVersion ($DBversion); } -- 2.39.5