Bug 7792:redefine the field branchcode as PRIMARY KEY of branches
authorPaul Poulain <paul.poulain@biblibre.com>
Mon, 28 May 2012 09:59:44 +0000 (11:59 +0200)
committerPaul Poulain <paul.poulain@biblibre.com>
Mon, 28 May 2012 09:59:44 +0000 (11:59 +0200)
Signed-off-by: Jared Camins-Esakov <jcamins@cpbibliography.com>
installer/data/mysql/kohastructure.sql
installer/data/mysql/updatedatabase.pl

index 8b1ab22..12ea9d1 100644 (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;
 
 --
index c801f00..51a6486 100755 (executable)
@@ -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);
 }