Ruby on rails 安装contrib软件包后pg_search dmetaphone不工作
安装pq_搜索并运行contrib包迁移后:Ruby on rails 安装contrib软件包后pg_search dmetaphone不工作,ruby-on-rails,rubygems,pg-search,Ruby On Rails,Rubygems,Pg Search,安装pq_搜索并运行contrib包迁移后: class InstallSomeContribPackages < ActiveRecord::Migration def up execute 'CREATE EXTENSION pg_trgm;' execute 'CREATE EXTENSION fuzzystrmatch;' end def down execute 'DROP EXTENSION pg_trgm;' execute 'D
class InstallSomeContribPackages < ActiveRecord::Migration
def up
execute 'CREATE EXTENSION pg_trgm;'
execute 'CREATE EXTENSION fuzzystrmatch;'
end
def down
execute 'DROP EXTENSION pg_trgm;'
execute 'DROP EXTENSION fuzzystrmatch;'
end
end
PG::UndefinedFunction: ERROR: function dmetaphone(text) does not exist
LINE 2: SELECT array_to_string(ARRAY(SELECT dmetaphone(unnest(rege...
我把这个问题贴在了其他与这个问题斗争的人身上 即使使用contrib包,我仍然需要安装fuzzystrmatch扩展 尝试rake db:setup和rake db:test:prepare 如果不起作用,则运行它们: 本地访问终端中的psql并创建扩展:
\psql
create extension fuzzystrmatch;
在heroku上,访问您的psql数据库并从终端创建扩展:
heroku pg:psql
create extension fuzzystrmatch;
然后重新运行迁移。希望这有助于减轻别人的压力。这真的很有帮助