如何在续集迁移中创建hstore列?
Sequel.migration do
change do
add_column :logs, :geo, HStore
end
end
失败.我必须加载扩展程序吗?
最佳答案 我在文档中找不到这个,所以我在IRC上问过.
jeremyevans: method_missing is used, allowing you to use any custom database types
因此,只要启用了扩展,您就可以指定json,jsonb:
Sequel.migration do
change do
create_table :foo do
primary_key :id
jsonb :bar
end
end
end
要启用扩展程序:
Sequel.extension :pg_json
并创建一个新的记录:
foo = Foo.new bar: Sequel.pg_jsonb({ 'baz' => 'qux' })