BigW Consortium Gitlab
Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
G
gitlab-ce
Project
Overview
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
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Commits
Issue Boards
Open sidebar
Forest Godfrey
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
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
31 additions
and
0 deletions
+31
-0
20170503185032_index_redirect_routes_path_for_like.rb
...ate/20170503185032_index_redirect_routes_path_for_like.rb
+29
-0
schema.rb
db/schema.rb
+1
-0
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
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_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
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
AddUsersLowerUsernameEmailIndexes
.
new
.
up
AddLowerPathIndexToRoutes
.
new
.
up
IndexRoutesPathForLike
.
new
.
up
IndexRedirectRoutesPathForLike
.
new
.
up
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