【发布时间】:2014-06-06 19:56:22
【问题描述】:
我正在尝试将 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
add_column :people, :custom_fields, :hstore
end
def down
remove_column :people, :custom_fields
end
end
根据this SO answer,我不必在每个架构上创建 hstore 扩展,而只需将其添加到例如公共架构。
除了添加 postgres 扩展来让 hstore 工作之外,我还需要做些什么吗?
感谢任何帮助。 :)
【问题讨论】:
-
尝试:\c
;创建扩展 hstore; -
我已经添加了hstore。所以我得到错误:'扩展“hstore”已经存在':-/
-
你的 PostgreSQL && Rails 是什么版本?
-
Postgres 9.3 版和 Rails 4.0.2
-
在 mac osx 上使用 Postgres 应用程序
标签: ruby-on-rails postgresql ruby-on-rails-4 hstore