Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
bugzilla
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
etersoft
bugzilla
Commits
8770b2cb
Commit
8770b2cb
authored
Jul 31, 2014
by
Frédéric Buclin
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Bug 1044561: Bad definition of indexes for the new user_api_keys DB table
r=sgreen a=glob
parent
98041ff1
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
19 additions
and
2 deletions
+19
-2
Schema.pm
Bugzilla/DB/Schema.pm
+2
-2
DB.pm
Bugzilla/Install/DB.pm
+17
-0
No files found.
Bugzilla/DB/Schema.pm
View file @
8770b2cb
...
...
@@ -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'
]
,
],
},
};
...
...
Bugzilla/Install/DB.pm
View file @
8770b2cb
...
...
@@ -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__
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment