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
db75057c
Commit
db75057c
authored
Mar 07, 2018
by
Bob Van Landuyt
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add the RedirectRoute#path index setup_postgresql
parent
f2b20e05
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
11 additions
and
9 deletions
+11
-9
db/post_migrate/20180306164012_add_path_index_to_redirect_routes.rb
...grate/20180306164012_add_path_index_to_redirect_routes.rb
+9
-9
lib/tasks/migrate/setup_postgresql.rake
lib/tasks/migrate/setup_postgresql.rake
+2
-0
No files found.
db/post_migrate/20180306164012_add_path_index_to_redirect_routes.rb
View file @
db75057c
...
...
@@ -22,17 +22,17 @@ class AddPathIndexToRedirectRoutes < ActiveRecord::Migration
disable_statement_timeout
if_not_exists
=
Gitlab
::
Database
.
version
.
to_f
>=
9.5
?
"IF NOT EXISTS"
:
""
# Unique index on lower(path) across both types of redirect_routes:
execute
(
"CREATE UNIQUE INDEX CONCURRENTLY
#{
if_not_exists
}
#{
INDEX_NAME
}
ON redirect_routes (lower(path) varchar_pattern_ops);"
)
unless
index_exists_by_name?
(
:redirect_routes
,
INDEX_NAME
)
execute
(
"CREATE UNIQUE INDEX CONCURRENTLY
#{
INDEX_NAME
}
ON redirect_routes (lower(path) varchar_pattern_ops);"
)
end
end
def
down
return
unless
Gitlab
::
Database
.
postgresql?
disable_statement_timeout
execute
(
"DROP INDEX IF EXISTS
#{
INDEX_NAME
}
;"
)
# Do nothing in the DOWN. Since the index above is originally created in the
# `ReworkRedirectRoutesIndexes`. This migration wouldn't have actually
# created any new index.
#
# This migration is only here to be called form `setup_postgresql.rake` so
# any newly created database would have this index.
end
end
lib/tasks/migrate/setup_postgresql.rake
View file @
db75057c
...
...
@@ -8,6 +8,7 @@ task setup_postgresql: :environment do
require
Rails
.
root
.
join
(
'db/migrate/20170503185032_index_redirect_routes_path_for_like'
)
require
Rails
.
root
.
join
(
'db/migrate/20171220191323_add_index_on_namespaces_lower_name.rb'
)
require
Rails
.
root
.
join
(
'db/migrate/20180215181245_users_name_lower_index.rb'
)
require
Rails
.
root
.
join
(
'db/post_migrate/20180306164012_add_path_index_to_redirect_routes.rb'
)
NamespacesProjectsPathLowerIndexes
.
new
.
up
AddUsersLowerUsernameEmailIndexes
.
new
.
up
...
...
@@ -17,4 +18,5 @@ task setup_postgresql: :environment do
IndexRedirectRoutesPathForLike
.
new
.
up
AddIndexOnNamespacesLowerName
.
new
.
up
UsersNameLowerIndex
.
new
.
up
AddPathIndexToRedirectRoutes
.
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