我正在部署使用PostgreSQL和HSTORE的Rails应用程序。我需要rubber。使用橡皮部署时启用hstore
一切正常,除非HSTORE未正确启用。当包含execute("CREATE EXTENSION hstore")
运行迁移,我收到以下错误:
** [out :: production.---]
** [out :: production.---] -- execute("CREATE EXTENSION hstore")
** [out :: production.---]
** [out :: production.---] rake aborted!
** [out :: production.---] An error has occurred, this and all later migrations canceled:
** [out :: production.---]
** [out :: production.---] PG::Error: ERROR: permission denied to create extension "hstore"
** [out :: production.---] HINT: Must be superuser to create this extension.
创建Postgres的实例的脚本有这样的代码:
create_user_cmd = "CREATE USER #{env.db_user} WITH NOSUPERUSER CREATEDB NOCREATEROLE"
,所以我觉得这个问题可能涉及到NOSUPERUSER
属性在这里设置。
有没有什么办法可以在使大部分生成的文件保持不变的情况下启用使用橡胶的hstore?
你试过了gem'activerecord-postgres-hstore'吗?它通过迁移来安装hstore的功能。 – 2013-03-01 18:34:19
问题在于运行迁移时的权限。我安装了宝石。 – pgb 2013-03-01 18:57:09