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
4da848ef
Commit
4da848ef
authored
May 03, 2017
by
Michael Kozono
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add index for source association and for path
parent
e8f2a700
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
26 additions
and
1 deletion
+26
-1
db/migrate/20170503184421_add_index_to_redirect_routes.rb
db/migrate/20170503184421_add_index_to_redirect_routes.rb
+22
-0
db/schema.rb
db/schema.rb
+4
-1
No files found.
db/migrate/20170503184421_add_index_to_redirect_routes.rb
0 → 100644
View file @
4da848ef
# See http://doc.gitlab.com/ce/development/migration_style_guide.html
# for more information on how to write migrations for GitLab.
# rubocop:disable RemoveIndex
class
AddIndexToRedirectRoutes
<
ActiveRecord
::
Migration
include
Gitlab
::
Database
::
MigrationHelpers
# Set this constant to true if this migration requires downtime.
DOWNTIME
=
false
disable_ddl_transaction!
def
up
add_concurrent_index
(
:redirect_routes
,
:path
,
unique:
true
)
add_concurrent_index
(
:redirect_routes
,
[
:source_type
,
:source_id
])
end
def
down
remove_index
(
:redirect_routes
,
:path
)
if
index_exists?
(
:redirect_routes
,
:path
)
remove_index
(
:redirect_routes
,
[
:source_type
,
:source_id
])
if
index_exists?
(
:redirect_routes
,
[
:source_type
,
:source_id
])
end
end
db/schema.rb
View file @
4da848ef
...
...
@@ -1048,6 +1048,9 @@ ActiveRecord::Schema.define(version: 20170504102911) do
t
.
datetime
"updated_at"
,
null:
false
end
add_index
"redirect_routes"
,
[
"path"
],
name:
"index_redirect_routes_on_path"
,
unique:
true
,
using: :btree
add_index
"redirect_routes"
,
[
"source_type"
,
"source_id"
],
name:
"index_redirect_routes_on_source_type_and_source_id"
,
using: :btree
create_table
"releases"
,
force: :cascade
do
|
t
|
t
.
string
"tag"
t
.
text
"description"
...
...
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