我正在部署一个使用 PostgreSQL 和 HSTORE 的 Rails 应用程序。
为了部署它,我使用了Rubber。
一切正常,除了 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,同时保持大部分生成的文件不变?