Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGitLab Bot <gitlab-bot@gitlab.com>2022-11-17 14:33:21 +0300
committerGitLab Bot <gitlab-bot@gitlab.com>2022-11-17 14:33:21 +0300
commit7021455bd1ed7b125c55eb1b33c5a01f2bc55ee0 (patch)
tree5bdc2229f5198d516781f8d24eace62fc7e589e9 /db/post_migrate/20221028000603_prepare_partial_trigram_indexes_for_issues_attempt_3.rb
parent185b095e93520f96e9cfc31d9c3e69b498cdab7c (diff)
Add latest changes from gitlab-org/gitlab@15-6-stable-eev15.6.0-rc42
Diffstat (limited to 'db/post_migrate/20221028000603_prepare_partial_trigram_indexes_for_issues_attempt_3.rb')
-rw-r--r--db/post_migrate/20221028000603_prepare_partial_trigram_indexes_for_issues_attempt_3.rb25
1 files changed, 25 insertions, 0 deletions
diff --git a/db/post_migrate/20221028000603_prepare_partial_trigram_indexes_for_issues_attempt_3.rb b/db/post_migrate/20221028000603_prepare_partial_trigram_indexes_for_issues_attempt_3.rb
new file mode 100644
index 00000000000..199a7a22d5b
--- /dev/null
+++ b/db/post_migrate/20221028000603_prepare_partial_trigram_indexes_for_issues_attempt_3.rb
@@ -0,0 +1,25 @@
+# frozen_string_literal: true
+
+class PreparePartialTrigramIndexesForIssuesAttempt3 < Gitlab::Database::Migration[2.0]
+ TITLE_INDEX_NAME = 'index_issues_on_title_trigram_non_latin'
+ DESCRIPTION_INDEX_NAME = 'index_issues_on_description_trigram_non_latin'
+
+ def up
+ prepare_async_index :issues, :title,
+ name: TITLE_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]*'"
+
+ prepare_async_index :issues, :description,
+ name: DESCRIPTION_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
+ unprepare_async_index_by_name :issues, DESCRIPTION_INDEX_NAME
+ unprepare_async_index_by_name :issues, TITLE_INDEX_NAME
+ end
+end