diff options
Diffstat (limited to 'db/post_migrate/20221104042159_add_partial_trigram_index_for_issue_description_attempt_2.rb')
-rw-r--r-- | db/post_migrate/20221104042159_add_partial_trigram_index_for_issue_description_attempt_2.rb | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/db/post_migrate/20221104042159_add_partial_trigram_index_for_issue_description_attempt_2.rb b/db/post_migrate/20221104042159_add_partial_trigram_index_for_issue_description_attempt_2.rb new file mode 100644 index 00000000000..36b595d1067 --- /dev/null +++ b/db/post_migrate/20221104042159_add_partial_trigram_index_for_issue_description_attempt_2.rb @@ -0,0 +1,19 @@ +# frozen_string_literal: true + +class AddPartialTrigramIndexForIssueDescriptionAttempt2 < Gitlab::Database::Migration[2.0] + disable_ddl_transaction! + + INDEX_NAME = 'index_issues_on_description_trigram_non_latin' + + def up + add_concurrent_index :issues, :description, + name: INDEX_NAME, + using: :gin, opclass: { description: :gin_trgm_ops }, + where: "title NOT SIMILAR TO '[\\u0000-\\u02FF\\u1E00-\\u1EFF\\u2070-\\u218F]*' " \ + "OR description NOT SIMILAR TO '[\\u0000-\\u02FF\\u1E00-\\u1EFF\\u2070-\\u218F]*'" + end + + def down + remove_concurrent_index_by_name :issues, INDEX_NAME + end +end |