Bug 7792:redefine the field branchcode as PRIMARY KEY of branches

Signed-off-by: Jared Camins-Esakov <jcamins@cpbibliography.com>
This commit is contained in:
Paul Poulain 2012-05-28 11:59:44 +02:00
parent 261d870601
commit 838269d1e7
2 changed files with 9 additions and 3 deletions

View file

@ -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;
--

View file

@ -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);
}