Add if_not_exists: true to migration (#18687)

This commit is contained in:
Ridhwana 2022-11-04 17:56:00 +02:00 committed by GitHub
parent 768eb219ef
commit 010cc9f617
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -4,6 +4,6 @@ class AddIndexToDisplayAdsCachedTagList < ActiveRecord::Migration[7.0]
def change
# From <https://www.postgresql.org/docs/11/pgtrgm.html#id-1.11.7.40.7>
# We need a GIN index on `cached_tag_list` to speed up `LIKE` queries
add_index :display_ads, :cached_tag_list, using: :gin, opclass: :gin_trgm_ops, algorithm: :concurrently
add_index :display_ads, :cached_tag_list, using: :gin, opclass: :gin_trgm_ops, algorithm: :concurrently, if_not_exists: true
end
end