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
Léo-Paul Géneau
gitlab-ce
Commits
03144e1c
Commit
03144e1c
authored
May 03, 2017
by
Michael Kozono
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Index redirect_routes path for LIKE
parent
4da848ef
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
31 additions
and
0 deletions
+31
-0
db/migrate/20170503185032_index_redirect_routes_path_for_like.rb
...ate/20170503185032_index_redirect_routes_path_for_like.rb
+29
-0
db/schema.rb
db/schema.rb
+1
-0
lib/tasks/migrate/setup_postgresql.rake
lib/tasks/migrate/setup_postgresql.rake
+1
-0
No files found.
db/migrate/20170503185032_index_redirect_routes_path_for_like.rb
0 → 100644
View file @
03144e1c
# See http://doc.gitlab.com/ce/development/migration_style_guide.html
# for more information on how to write migrations for GitLab.
class
IndexRedirectRoutesPathForLike
<
ActiveRecord
::
Migration
include
Gitlab
::
Database
::
MigrationHelpers
# Set this constant to true if this migration requires downtime.
DOWNTIME
=
false
INDEX_NAME
=
'index_redirect_routes_on_path_text_pattern_ops'
disable_ddl_transaction!
def
up
return
unless
Gitlab
::
Database
.
postgresql?
unless
index_exists?
(
:redirect_routes
,
:path
,
name:
INDEX_NAME
)
execute
(
"CREATE INDEX CONCURRENTLY
#{
INDEX_NAME
}
ON redirect_routes (path varchar_pattern_ops);"
)
end
end
def
down
return
unless
Gitlab
::
Database
.
postgresql?
if
index_exists?
(
:redirect_routes
,
:path
,
name:
INDEX_NAME
)
execute
(
"DROP INDEX CONCURRENTLY
#{
INDEX_NAME
}
;"
)
end
end
end
db/schema.rb
View file @
03144e1c
...
@@ -1049,6 +1049,7 @@ ActiveRecord::Schema.define(version: 20170504102911) do
...
@@ -1049,6 +1049,7 @@ ActiveRecord::Schema.define(version: 20170504102911) do
end
end
add_index
"redirect_routes"
,
[
"path"
],
name:
"index_redirect_routes_on_path"
,
unique:
true
,
using: :btree
add_index
"redirect_routes"
,
[
"path"
],
name:
"index_redirect_routes_on_path"
,
unique:
true
,
using: :btree
add_index
"redirect_routes"
,
[
"path"
],
name:
"index_redirect_routes_on_path_text_pattern_ops"
,
using: :btree
,
opclasses:
{
"path"
=>
"varchar_pattern_ops"
}
add_index
"redirect_routes"
,
[
"source_type"
,
"source_id"
],
name:
"index_redirect_routes_on_source_type_and_source_id"
,
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
|
create_table
"releases"
,
force: :cascade
do
|
t
|
...
...
lib/tasks/migrate/setup_postgresql.rake
View file @
03144e1c
...
@@ -11,4 +11,5 @@ task setup_postgresql: :environment do
...
@@ -11,4 +11,5 @@ task setup_postgresql: :environment do
AddUsersLowerUsernameEmailIndexes
.
new
.
up
AddUsersLowerUsernameEmailIndexes
.
new
.
up
AddLowerPathIndexToRoutes
.
new
.
up
AddLowerPathIndexToRoutes
.
new
.
up
IndexRoutesPathForLike
.
new
.
up
IndexRoutesPathForLike
.
new
.
up
IndexRedirectRoutesPathForLike
.
new
.
up
end
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