我一直在尝试将我的数据库迁移到使用HSTORE,但是这个扩展只能在public SCHEMA中工作。当我想在其他模式中添加一个HSTORE列时,它就无法工作了。
def up
# My hstore looks like this
execute "CREATE EXTENSION hstore SCHEMA public"
# I have also tried
# execute "CREATE EXTENSION hstore"
end
但是当我运行我的下一个迁移时,它就无法工作了,如果我进入psql控制台并更改表格,我会得到以下内容:
set search_path to public;
alter table accounts add column extras hstore; -- Works fine
set search_path to schema2;
alter table accounts add column extras hstore; -- Raises an error
我正在使用Rails 4。谢谢。
SET SEARCH_PATH TO schema2, public
。 - Boris Barroso