我想從我的rails應用程序運行db:migrate。無法在postgresql中運行「create extension hstore」
遷移文件:
def self.up
enable_extension "hstore"
end
def self.down
disable_extension "hstore"
end
錯誤:
-- enable_extension("hstore")
rake aborted!
StandardError: An error has occurred, this and all later migrations canceled:PG::UndefinedFile: ERROR: could not open extension control file "/usr/pgsql-9.4/share/extension/hstore.control": No such file or directory : CREATE EXTENSION IF NOT EXISTS "hstore"/gems/activerecord-4.2.0/lib/active_record/connection_adapters/postgresql_adapter.rb:592:in `async_exec'
postgres=# select version(); ==> PostgreSQL 9.4.4 on x86_64-unknown-linux-gnu, compiled by gcc (GCC) 4.4.7 20120313 (Red Hat 4.4.7-11), 64-bit
(1 row)
關於這個問題搜索後,我發現了 'hstore' 依賴可以使用PostgreSQL-的contrib來解決。我添加了postgresql-contrib,但仍然沒有用。
yum install postgresql ==> Package postgresql-8.4.20-2.el6_6.x86_64 already installed and latest version
yum install postgresql-contrib ==> Package postgresql-contrib-8.4.20-2.el6_6.x86_64 already installed and latest version
這些軟件包似乎適用於Postgres 8.4。試試'yum install postgresql94-contrib'。 –
謝謝!有效。 – user3139250
@NickBarnes,請發表您的評論作爲答案。所以我可以upvote。它確實有幫助。 –