2014-06-06 24 views
0

我試圖將hstore添加到我的應用程序。但是,我得到一個錯誤,告訴我hstore不存在。無法將hstore列添加到多租戶導軌4 applicaiton(基於postgres架構)

PG::UndefinedObject: ERROR: type "hstore" does not exist 
LINE 1: ALTER TABLE "people" ADD COLUMN "custom_fields" hstore 

這是我的移民:

class AddCustomFieldsToPeople < ActiveRecord::Migration 
    def up 
    add_column :people, :custom_fields, :hstore 
    end 

    def down 
    remove_column :people, :custom_fields 
    end 
end 

Acording到this SO answer我沒有建立在每一個架構hstore extention但只是把它添加到例如公共架構。

有什麼我需要做的其他添加postgres擴展名讓hstore工作?

任何幫助表示讚賞。 :)

+1

嘗試:\ C ; 創建擴展hstore; – Vakiliy

+0

我已經添加hstore。所以我得到錯誤:'擴展名'hstore「已經存在': -/ –

+0

什麼是您的PostgreSQL && Rails版本? – Vakiliy

回答

1

生成這個和耙遷移:

class AddHstore < ActiveRecord::Migration 
    def up 
    enable_extension :hstore 
    end 

    def down 
    disable_extension :hstore 
    end 
end  

既然你將有一個遷移已經掛起,用耙分貝:遷移:後續版本=