Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
G
gitlab-ce
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Boxiang Sun
gitlab-ce
Commits
b0eafaac
Commit
b0eafaac
authored
Jul 09, 2019
by
Brett Walker
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add index for issues on relative position, project
and state
parent
8073b055
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
27 additions
and
1 deletion
+27
-1
app/models/issue.rb
app/models/issue.rb
+1
-1
changelogs/unreleased/bw-add-index-for-relative-position.yml
changelogs/unreleased/bw-add-index-for-relative-position.yml
+5
-0
db/migrate/20190709220143_add_index_to_issues_relative_position.rb
...e/20190709220143_add_index_to_issues_relative_position.rb
+20
-0
db/schema.rb
db/schema.rb
+1
-0
No files found.
app/models/issue.rb
View file @
b0eafaac
...
...
@@ -131,7 +131,7 @@ class Issue < ApplicationRecord
when
'due_date'
then
order_due_date_asc
when
'due_date_asc'
then
order_due_date_asc
when
'due_date_desc'
then
order_due_date_desc
when
'relative_position'
then
order_relative_position_asc
when
'relative_position'
then
order_relative_position_asc
.
with_order_id_desc
else
super
end
...
...
changelogs/unreleased/bw-add-index-for-relative-position.yml
0 → 100644
View file @
b0eafaac
---
title
:
Add index for issues on relative position, project, and state for manual sorting
merge_request
:
30542
author
:
type
:
fixed
db/migrate/20190709220143_add_index_to_issues_relative_position.rb
0 → 100644
View file @
b0eafaac
# frozen_string_literal: true
class
AddIndexToIssuesRelativePosition
<
ActiveRecord
::
Migration
[
5.1
]
include
Gitlab
::
Database
::
MigrationHelpers
# Set this constant to true if this migration requires downtime.
DOWNTIME
=
false
disable_ddl_transaction!
INDEX_NAME
=
'index_issues_on_project_id_and_state_and_rel_position_and_id'
.
freeze
def
up
add_concurrent_index
:issues
,
[
:project_id
,
:state
,
:relative_position
,
:id
],
order:
{
id: :desc
},
name:
INDEX_NAME
end
def
down
remove_concurrent_index_by_name
:issues
,
INDEX_NAME
end
end
db/schema.rb
View file @
b0eafaac
...
...
@@ -1682,6 +1682,7 @@ ActiveRecord::Schema.define(version: 2019_07_15_114644) do
t
.
index
[
"project_id"
,
"created_at"
,
"id"
,
"state"
],
name:
"index_issues_on_project_id_and_created_at_and_id_and_state"
,
using: :btree
t
.
index
[
"project_id"
,
"due_date"
,
"id"
,
"state"
],
name:
"idx_issues_on_project_id_and_due_date_and_id_and_state_partial"
,
where:
"(due_date IS NOT NULL)"
,
using: :btree
t
.
index
[
"project_id"
,
"iid"
],
name:
"index_issues_on_project_id_and_iid"
,
unique:
true
,
using: :btree
t
.
index
[
"project_id"
,
"state"
,
"relative_position"
,
"id"
],
name:
"index_issues_on_project_id_and_state_and_rel_position_and_id"
,
order:
{
id: :desc
},
using: :btree
t
.
index
[
"project_id"
,
"updated_at"
,
"id"
,
"state"
],
name:
"index_issues_on_project_id_and_updated_at_and_id_and_state"
,
using: :btree
t
.
index
[
"relative_position"
],
name:
"index_issues_on_relative_position"
,
using: :btree
t
.
index
[
"state"
],
name:
"index_issues_on_state"
,
using: :btree
...
...
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