summaryrefslogtreecommitdiffstats
path: root/Bugzilla
diff options
context:
space:
mode:
authorFrédéric Buclin <LpSolit@gmail.com>2014-07-31 18:38:18 +0200
committerFrédéric Buclin <LpSolit@gmail.com>2014-07-31 18:38:18 +0200
commit8770b2cb9cbbb61c1eae54c9ce1f564f9d350044 (patch)
tree371b4b06a423afa27e45439529f1b1d21cf7f320 /Bugzilla
parent98041ff1623da960b1ded466957ba1fabd3ab7cd (diff)
downloadbugzilla-8770b2cb9cbbb61c1eae54c9ce1f564f9d350044.tar.gz
bugzilla-8770b2cb9cbbb61c1eae54c9ce1f564f9d350044.tar.xz
Bug 1044561: Bad definition of indexes for the new user_api_keys DB table
r=sgreen a=glob
Diffstat (limited to 'Bugzilla')
-rw-r--r--Bugzilla/DB/Schema.pm4
-rw-r--r--Bugzilla/Install/DB.pm17
2 files changed, 19 insertions, 2 deletions
diff --git a/Bugzilla/DB/Schema.pm b/Bugzilla/DB/Schema.pm
index b175f1554..2fa811042 100644
--- a/Bugzilla/DB/Schema.pm
+++ b/Bugzilla/DB/Schema.pm
@@ -1749,8 +1749,8 @@ use constant ABSTRACT_SCHEMA => {
last_used => {TYPE => 'DATETIME'},
],
INDEXES => [
- user_api_keys_key => {FIELDS => ['api_key'], TYPE => 'UNIQUE'},
- user_api_keys_user_id => {FIELDS => ['user_id']},
+ user_api_keys_api_key_idx => {FIELDS => ['api_key'], TYPE => 'UNIQUE'},
+ user_api_keys_user_id_idx => ['user_id'],
],
},
};
diff --git a/Bugzilla/Install/DB.pm b/Bugzilla/Install/DB.pm
index bbddf1620..74b2b1e39 100644
--- a/Bugzilla/Install/DB.pm
+++ b/Bugzilla/Install/DB.pm
@@ -723,6 +723,9 @@ sub update_table_definitions {
$dbh->bz_alter_column('tokens', 'tokentype',
{TYPE => 'varchar(16)', NOTNULL => 1});
+ # 2014-07-27 LpSolit@gmail.com - Bug 1044561
+ _fix_user_api_keys_indexes();
+
################################################################
# New --TABLE-- changes should go *** A B O V E *** this point #
################################################################
@@ -3881,6 +3884,20 @@ sub _fix_components_primary_key {
}
}
+sub _fix_user_api_keys_indexes {
+ my $dbh = Bugzilla->dbh;
+
+ if ($dbh->bz_index_info('user_api_keys', 'user_api_keys_key')) {
+ $dbh->bz_drop_index('user_api_keys', 'user_api_keys_key');
+ $dbh->bz_add_index('user_api_keys', 'user_api_keys_api_key_idx',
+ { FIELDS => ['api_key'], TYPE => 'UNIQUE' });
+ }
+ if ($dbh->bz_index_info('user_api_keys', 'user_api_keys_user_id')) {
+ $dbh->bz_drop_index('user_api_keys', 'user_api_keys_user_id');
+ $dbh->bz_add_index('user_api_keys', 'user_api_keys_user_id_idx', ['user_id']);
+ }
+}
+
1;
__END__