Ruby on rails 无法将hstore列添加到multitenant rails 4应用程序(基于postgres架构)
我正在尝试将hstore添加到我的应用程序中。但是,我得到一个错误,告诉我hstore不存在Ruby on rails 无法将hstore列添加到multitenant rails 4应用程序(基于postgres架构),ruby-on-rails,postgresql,ruby-on-rails-4,hstore,Ruby On Rails,Postgresql,Ruby On Rails 4,Hstore,我正在尝试将hstore添加到我的应用程序中。但是,我得到一个错误,告诉我hstore不存在 PG::UndefinedObject: ERROR: type "hstore" does not exist LINE 1: ALTER TABLE "people" ADD COLUMN "custom_fields" hstore 这是我的迁移: class AddCustomFieldsToPeople < ActiveRecord::Migration def up a
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
class AddCustomFieldsToPeople
根据,我不必在每个模式上创建hstore扩展,只需将其添加到公共模式中即可
除了添加postgres扩展以使hstore正常工作之外,我还需要做什么吗
感谢您的帮助。:) 使用此命令和rake生成迁移:
class AddHstore < ActiveRecord::Migration
def up
enable_extension :hstore
end
def down
disable_extension :hstore
end
end
class AddHstore
因为您已经有一个迁移挂起,所以请使用rake db:migrate:up VERSION=Try:\c;创建扩展存储;我已经添加了hstore。所以我得到了一个错误:“扩展名“hstore”已经存在”:-/您的PostgreSQL和Rails版本是什么?Postgres版本9.3和Rails版本4.0.2使用适用于mac osx的Postgres应用程序