From 4f268b61ddd133dc203241955f9240fb2a5c1957 Mon Sep 17 00:00:00 2001 From: Prima Aulia Gusta Date: Sat, 13 Mar 2021 12:12:10 +0800 Subject: [PATCH] Enabled the extension on the feature migration Perhaps it's not a bad idea to enable the extensions together with the generator. I saw a couple of junior devs stumbled on getting this feature working. Sorry --- .../templates/add_pg_search_dmetaphone_support_functions.rb.erb | 2 ++ 1 file changed, 2 insertions(+) diff --git a/lib/pg_search/migration/templates/add_pg_search_dmetaphone_support_functions.rb.erb b/lib/pg_search/migration/templates/add_pg_search_dmetaphone_support_functions.rb.erb index 6c9f9224..28c22c80 100644 --- a/lib/pg_search/migration/templates/add_pg_search_dmetaphone_support_functions.rb.erb +++ b/lib/pg_search/migration/templates/add_pg_search_dmetaphone_support_functions.rb.erb @@ -1,5 +1,6 @@ class AddPgSearchDmetaphoneSupportFunctions < ActiveRecord::Migration<%= migration_version %> def up + execute "CREATE EXTENSION IF NOT EXISTS fuzzystrmatch;" say_with_time("Adding support functions for pg_search :dmetaphone") do execute <<~'SQL'.squish <%= indent(read_sql_file("dmetaphone"), 8) %> @@ -8,6 +9,7 @@ class AddPgSearchDmetaphoneSupportFunctions < ActiveRecord::Migration<%= migrati end def down + execute "DROP EXTENSION IF EXISTS fuzzystrmatch;" say_with_time("Dropping support functions for pg_search :dmetaphone") do execute <<~'SQL'.squish <%= indent(read_sql_file("uninstall_dmetaphone"), 8) %>