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
dcb55f3e
Commit
dcb55f3e
authored
Mar 21, 2017
by
Douwe Maan
Committed by
Lin Jen-Shin
Mar 21, 2017
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Merge branch 'index-routes-path-for-like' into 'master'
Add LIKE index for routes.path Closes #29554 See merge request !10060
parent
a719bbe4
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
36 additions
and
4 deletions
+36
-4
20170317203554_index_routes_path_for_like.rb
db/migrate/20170317203554_index_routes_path_for_like.rb
+29
-0
schema.rb
db/schema.rb
+5
-4
setup_postgresql.rake
lib/tasks/migrate/setup_postgresql.rake
+2
-0
No files found.
db/migrate/20170317203554_index_routes_path_for_like.rb
0 → 100644
View file @
dcb55f3e
# See http://doc.gitlab.com/ce/development/migration_style_guide.html
# for more information on how to write migrations for GitLab.
class
IndexRoutesPathForLike
<
ActiveRecord
::
Migration
include
Gitlab
::
Database
::
MigrationHelpers
# Set this constant to true if this migration requires downtime.
DOWNTIME
=
false
INDEX_NAME
=
'index_routes_on_path_text_pattern_ops'
disable_ddl_transaction!
def
up
return
unless
Gitlab
::
Database
.
postgresql?
unless
index_exists?
(
:routes
,
name:
INDEX_NAME
)
execute
(
"CREATE INDEX CONCURRENTLY
#{
INDEX_NAME
}
ON routes (path varchar_pattern_ops);"
)
end
end
def
down
return
unless
Gitlab
::
Database
.
postgresql?
if
index_exists?
(
:routes
,
name:
INDEX_NAME
)
execute
(
"DROP INDEX CONCURRENTLY
#{
INDEX_NAME
}
;"
)
end
end
end
db/schema.rb
View file @
dcb55f3e
...
...
@@ -11,7 +11,7 @@
#
# It's strongly recommended that you check this file into your version control system.
ActiveRecord
::
Schema
.
define
(
version:
2017031
517463
4
)
do
ActiveRecord
::
Schema
.
define
(
version:
2017031
720355
4
)
do
# These are extensions that must be enabled in order to support this database
enable_extension
"plpgsql"
...
...
@@ -61,6 +61,7 @@ ActiveRecord::Schema.define(version: 20170315174634) do
t
.
boolean
"shared_runners_enabled"
,
default:
true
,
null:
false
t
.
integer
"max_artifacts_size"
,
default:
100
,
null:
false
t
.
string
"runners_registration_token"
t
.
integer
"max_pages_size"
,
default:
100
,
null:
false
t
.
boolean
"require_two_factor_authentication"
,
default:
false
t
.
integer
"two_factor_grace_period"
,
default:
48
t
.
boolean
"metrics_enabled"
,
default:
false
...
...
@@ -110,7 +111,6 @@ ActiveRecord::Schema.define(version: 20170315174634) do
t
.
string
"plantuml_url"
t
.
boolean
"plantuml_enabled"
t
.
integer
"terminal_max_session_time"
,
default:
0
,
null:
false
t
.
integer
"max_pages_size"
,
default:
100
,
null:
false
t
.
string
"default_artifacts_expire_in"
,
default:
"0"
,
null:
false
t
.
integer
"unique_ips_limit_per_user"
t
.
integer
"unique_ips_limit_time_window"
...
...
@@ -687,8 +687,8 @@ ActiveRecord::Schema.define(version: 20170315174634) do
t
.
integer
"visibility_level"
,
default:
20
,
null:
false
t
.
boolean
"request_access_enabled"
,
default:
false
,
null:
false
t
.
datetime
"deleted_at"
t
.
boolean
"lfs_enabled"
t
.
text
"description_html"
t
.
boolean
"lfs_enabled"
t
.
integer
"parent_id"
end
...
...
@@ -983,6 +983,7 @@ ActiveRecord::Schema.define(version: 20170315174634) do
end
add_index
"routes"
,
[
"path"
],
name:
"index_routes_on_path"
,
unique:
true
,
using: :btree
add_index
"routes"
,
[
"path"
],
name:
"index_routes_on_path_text_pattern_ops"
,
using: :btree
,
opclasses:
{
"path"
=>
"varchar_pattern_ops"
}
add_index
"routes"
,
[
"source_type"
,
"source_id"
],
name:
"index_routes_on_source_type_and_source_id"
,
unique:
true
,
using: :btree
create_table
"sent_notifications"
,
force: :cascade
do
|
t
|
...
...
@@ -1229,8 +1230,8 @@ ActiveRecord::Schema.define(version: 20170315174634) do
t
.
datetime
"otp_grace_period_started_at"
t
.
boolean
"ldap_email"
,
default:
false
,
null:
false
t
.
boolean
"external"
,
default:
false
t
.
string
"organization"
t
.
string
"incoming_email_token"
t
.
string
"organization"
t
.
boolean
"authorized_projects_populated"
t
.
boolean
"ghost"
end
...
...
lib/tasks/migrate/setup_postgresql.rake
View file @
dcb55f3e
...
...
@@ -3,10 +3,12 @@ require Rails.root.join('lib/gitlab/database/migration_helpers')
require
Rails
.
root
.
join
(
'db/migrate/20151007120511_namespaces_projects_path_lower_indexes'
)
require
Rails
.
root
.
join
(
'db/migrate/20151008110232_add_users_lower_username_email_indexes'
)
require
Rails
.
root
.
join
(
'db/migrate/20161212142807_add_lower_path_index_to_routes'
)
require
Rails
.
root
.
join
(
'db/migrate/20170317203554_index_routes_path_for_like'
)
desc
'GitLab | Sets up PostgreSQL'
task
setup_postgresql: :environment
do
NamespacesProjectsPathLowerIndexes
.
new
.
up
AddUsersLowerUsernameEmailIndexes
.
new
.
up
AddLowerPathIndexToRoutes
.
new
.
up
IndexRoutesPathForLike
.
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