Bug 7794:redefine the field id as PRIMARY KEY of sessions
authorStéphane Delaune <stephane.delaune@biblibre.com>
Thu, 22 Mar 2012 10:48:36 +0000 (11:48 +0100)
committerPaul Poulain <paul.poulain@biblibre.com>
Mon, 28 May 2012 09:46:47 +0000 (11:46 +0200)
Signed-off-by: Jared Camins-Esakov <jcamins@cpbibliography.com>
Signed-off-by: Paul Poulain <paul.poulain@biblibre.com>
installer/data/mysql/kohastructure.sql
installer/data/mysql/updatedatabase.pl

index 494691a..8b1ab22 100644 (file)
@@ -1780,7 +1780,7 @@ DROP TABLE IF EXISTS sessions;
 CREATE TABLE sessions (
   `id` varchar(32) NOT NULL,
   `a_session` text NOT NULL,
-  UNIQUE KEY id (id)
+  PRIMARY KEY (`id`)
 ) ENGINE=InnoDB DEFAULT CHARSET=utf8;
 
 --
index 8bc97cb..a263fa5 100755 (executable)
@@ -5293,6 +5293,13 @@ if ( C4::Context->preference("Version") < TransformToNum($DBversion) ) {
     SetVersion($DBversion);
 }
 
+$DBversion = "XXX";
+if (C4::Context->preference("Version") < TransformToNum($DBversion)) {
+    $dbh->do("ALTER TABLE sessions ADD PRIMARY KEY (id);");
+    print "Upgrade to $DBversion done (redefine the field id as PRIMARY KEY of sessions)\n";
+    SetVersion ($DBversion);
+}
+
 =head1 FUNCTIONS
 
 =head2 TableExists($table)