diff options
author | abcang <abcang1015@gmail.com> | 2021-04-25 13:33:28 +0900 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-04-25 06:33:28 +0200 |
commit | 7f0c49c58ab75bbd6b4dc44d47a8c4ab57db9d51 (patch) | |
tree | 3f58aeae3eab31145fb52560cc789aa0fe3d0a96 /db/migrate | |
parent | daccc07dc170627b17564402296f6c8631d0cd97 (diff) |
Improve tag search query (#16104)
Diffstat (limited to 'db/migrate')
-rw-r--r-- | db/migrate/20210421121431_add_case_insensitive_btree_index_to_tags.rb | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/db/migrate/20210421121431_add_case_insensitive_btree_index_to_tags.rb b/db/migrate/20210421121431_add_case_insensitive_btree_index_to_tags.rb new file mode 100644 index 000000000..ed359e8cd --- /dev/null +++ b/db/migrate/20210421121431_add_case_insensitive_btree_index_to_tags.rb @@ -0,0 +1,13 @@ +class AddCaseInsensitiveBtreeIndexToTags < ActiveRecord::Migration[5.2] + disable_ddl_transaction! + + def up + safety_assured { execute 'CREATE UNIQUE INDEX CONCURRENTLY index_tags_on_name_lower_btree ON tags (lower(name) text_pattern_ops)' } + remove_index :tags, name: 'index_tags_on_name_lower' + end + + def down + safety_assured { execute 'CREATE UNIQUE INDEX CONCURRENTLY index_tags_on_name_lower ON tags (lower(name))' } + remove_index :tags, name: 'index_tags_on_name_lower_btree' + end +end |