summaryrefslogtreecommitdiff
path: root/db/migrate/20190927074328_add_index_on_snippet_content.rb
diff options
context:
space:
mode:
authorGitLab Bot <gitlab-bot@gitlab.com>2019-09-27 18:06:20 +0000
committerGitLab Bot <gitlab-bot@gitlab.com>2019-09-27 18:06:20 +0000
commit2abb1b54c0305b359b178d6660810e865f619c22 (patch)
treee388953a0566ef9844b0b98cdb34236049721a14 /db/migrate/20190927074328_add_index_on_snippet_content.rb
parent8320f7956d72986f5a7c850874fce4f8b5a8e015 (diff)
downloadgitlab-ce-2abb1b54c0305b359b178d6660810e865f619c22.tar.gz
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'db/migrate/20190927074328_add_index_on_snippet_content.rb')
-rw-r--r--db/migrate/20190927074328_add_index_on_snippet_content.rb18
1 files changed, 18 insertions, 0 deletions
diff --git a/db/migrate/20190927074328_add_index_on_snippet_content.rb b/db/migrate/20190927074328_add_index_on_snippet_content.rb
new file mode 100644
index 00000000000..ef7583508f2
--- /dev/null
+++ b/db/migrate/20190927074328_add_index_on_snippet_content.rb
@@ -0,0 +1,18 @@
+# frozen_string_literal: true
+
+class AddIndexOnSnippetContent < ActiveRecord::Migration[5.2]
+ include Gitlab::Database::MigrationHelpers
+
+ DOWNTIME = false
+ INDEX_NAME = 'index_snippets_on_content_trigram'
+
+ disable_ddl_transaction!
+
+ def up
+ add_concurrent_index :snippets, :content, name: INDEX_NAME, using: :gin, opclass: { content: :gin_trgm_ops }
+ end
+
+ def down
+ remove_concurrent_index_by_name(:snippets, INDEX_NAME)
+ end
+end