我正在部署使用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