2020-06-29 14:40:21 +02:00
|
|
|
# frozen_string_literal: true
|
|
|
|
|
|
|
|
# Recreate the pg_trgm extension to upgrade from v1.1 to v1.3
|
|
|
|
# This will enable the function word_similarity(text, text) for the project's full-text searches
|
|
|
|
class UpdatePgTrgm < ActiveRecord::Migration[5.2]
|
|
|
|
# PostgreSQL only
|
2020-06-30 15:58:39 +02:00
|
|
|
def up
|
2020-06-29 14:40:21 +02:00
|
|
|
say_with_time('Upgrade extension :pg_trgm') do
|
|
|
|
execute <<~SQL
|
2020-06-30 15:58:39 +02:00
|
|
|
ALTER EXTENSION pg_trgm UPDATE;
|
2020-06-29 14:40:21 +02:00
|
|
|
SQL
|
|
|
|
end
|
|
|
|
end
|
2020-06-30 15:58:39 +02:00
|
|
|
|
|
|
|
def down
|
2022-01-11 16:15:43 +01:00
|
|
|
# we cannot downgrade a postgresSQL extension, so we do nothing
|
2020-06-30 15:58:39 +02:00
|
|
|
execute <<~SQL
|
|
|
|
ALTER EXTENSION pg_trgm UPDATE;
|
|
|
|
SQL
|
|
|
|
end
|
2020-06-29 14:40:21 +02:00
|
|
|
end
|