[Koha-patches] [PATCH] Bug 2559 Added primary keys to tables per comments

Nicole Engard nengard at gmail.com
Wed Aug 26 01:14:11 CEST 2009


>From ef4871dedb465230f178512c47571811719e8b5c Mon Sep 17 00:00:00 2001
From: Nicole Engard <nengard at gmail.com>
Date: Tue, 25 Aug 2009 13:00:24 -0400
Subject: [PATCH] Bug 2559 Added primary keys to tables per comments
Content-Type: text/plain; charset="utf-8"

---
 installer/data/mysql/kohastructure.sql |    6 ++++++
 installer/data/mysql/updatedatabase.pl |    9 +++++++++
 2 files changed, 15 insertions(+), 0 deletions(-)

diff --git a/installer/data/mysql/kohastructure.sql
b/installer/data/mysql/kohastructure.sql
index a12f4fd..32b0ee6 100644
--- a/installer/data/mysql/kohastructure.sql
+++ b/installer/data/mysql/kohastructure.sql
@@ -2154,6 +2154,8 @@ CREATE TABLE language_subtag_registry (
         type varchar(25), --
language-script-region-variant-extension-privateuse
         description varchar(25), -- only one of the possible
descriptions for ease of reference, see language_descriptions for the
complete list
         added date,
+        id int(11) NOT NULL auto_increment,
+        PRIMARY KEY  (`id`),
         KEY `subtag` (`subtag`)
 ) ENGINE=InnoDB DEFAULT CHARSET=utf8;

@@ -2164,6 +2166,8 @@ DROP TABLE IF EXISTS language_rfc4646_to_iso639;
 CREATE TABLE language_rfc4646_to_iso639 (
         rfc4646_subtag varchar(25),
         iso639_2_code varchar(25),
+        id int(11) NOT NULL auto_increment,
+        PRIMARY KEY  (`id`),
         KEY `rfc4646_subtag` (`rfc4646_subtag`)
 ) ENGINE=InnoDB DEFAULT CHARSET=utf8;

@@ -2173,6 +2177,8 @@ CREATE TABLE language_descriptions (
         type varchar(25),
         lang varchar(25),
         description varchar(255),
+        id int(11) NOT NULL auto_increment,
+        PRIMARY KEY  (`id`),
         KEY `lang` (`lang`)
 ) ENGINE=InnoDB DEFAULT CHARSET=utf8;

diff --git a/installer/data/mysql/updatedatabase.pl
b/installer/data/mysql/updatedatabase.pl
index 8628af9..16cd3df 100755
--- a/installer/data/mysql/updatedatabase.pl
+++ b/installer/data/mysql/updatedatabase.pl
@@ -2616,6 +2616,15 @@ $DBversion = '3.01.00.XXX';
      SetVersion ($DBversion);
      print "Upgrade to $DBversion done (Bug 2576 : Add OPACFinesTab
syspref)\n";
      }
+
+$DBversion = '3.01.00.XXX';
+     if (C4::Context->preference("Version") < TransformToNum($DBversion)) {
+     $dbh->do("ALTER TABLE `language_subtag_registry` ADD `id` INT(
11 ) NOT NULL AUTO_INCREMENT PRIMARY KEY;");
+     $dbh->do("ALTER TABLE `language_rfc4646_to_iso639` ADD `id` INT(
11 ) NOT NULL AUTO_INCREMENT PRIMARY KEY;");
+     $dbh->do("ALTER TABLE `language_descriptions` ADD `id` INT( 11 )
NOT NULL AUTO_INCREMENT PRIMARY KEY;");
+     SetVersion ($DBversion);
+     print "Upgrade to $DBversion done (Added primary keys to
language tables)\n";
+     }

 =item DropAllForeignKeys($table)

-- 
1.5.6.5
-------------- next part --------------
A non-text attachment was scrubbed...
Name: 0006-Bug-2559-Added-primary-keys-to-tables-per-comments.patch
Type: application/octet-stream
Size: 2765 bytes
Desc: not available
URL: </pipermail/koha-patches/attachments/20090825/6bd40ac5/attachment-0001.obj>


More information about the Koha-patches mailing list