From 2ce2e973c943e3796a1179cc043a8d43b7b16bc6 Mon Sep 17 00:00:00 2001 From: Nicole Engard Date: Sun, 6 Sep 2009 13:45:08 -0400 Subject: [PATCH] Bug 2559 Added primary keys to tables per comments Signed-off-by: Galen Charlton --- installer/data/mysql/kohastructure.sql | 6 ++++++ installer/data/mysql/updatedatabase.pl | 9 +++++++++ 2 files changed, 15 insertions(+) diff --git a/installer/data/mysql/kohastructure.sql b/installer/data/mysql/kohastructure.sql index 23e5b10b11..cdf7f423c7 100644 --- a/installer/data/mysql/kohastructure.sql +++ b/installer/data/mysql/kohastructure.sql @@ -2138,6 +2138,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; @@ -2148,6 +2150,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; @@ -2157,6 +2161,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 24154eb36f..fca65c4980 100755 --- a/installer/data/mysql/updatedatabase.pl +++ b/installer/data/mysql/updatedatabase.pl @@ -2634,6 +2634,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) -- 2.39.5