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
1
Merge Requests
1
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
nexedi
gitlab-ce
Commits
dcd54f63
Commit
dcd54f63
authored
Apr 18, 2016
by
Stan Hu
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Attempt to create pg_trgm extension in migration for test/dev environments
Closes #15210
parent
bfa16dbc
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
11 additions
and
0 deletions
+11
-0
db/migrate/20160226114608_add_trigram_indexes_for_searching.rb
...grate/20160226114608_add_trigram_indexes_for_searching.rb
+11
-0
No files found.
db/migrate/20160226114608_add_trigram_indexes_for_searching.rb
View file @
dcd54f63
...
...
@@ -4,6 +4,8 @@ class AddTrigramIndexesForSearching < ActiveRecord::Migration
def
up
return
unless
Gitlab
::
Database
.
postgresql?
create_trigrams_extension
unless
trigrams_enabled?
raise
'You must enable the pg_trgm extension. You can do so by running '
\
'"CREATE EXTENSION pg_trgm;" as a PostgreSQL super user, this must be '
\
...
...
@@ -37,6 +39,15 @@ class AddTrigramIndexesForSearching < ActiveRecord::Migration
row
&&
row
[
'enabled'
]
==
't'
?
true
:
false
end
def
create_trigrams_extension
# This may not work if the user doesn't have permission. We attempt in
# case we do have permission, particularly for test/dev environments.
begin
enable_extension
'pg_trgm'
rescue
end
end
def
to_index
{
ci_runners:
[
:token
,
: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