我正试图在这一行中插入:
schema.db
t.text "address_field"
address.rb
serialize :address_field, Hash
迁移文件
enable_extension 'hstore' unless extension_enabled?('hstore')
values = []
Address.find_each do |address|
new_address_field = {first_line => "Street", second_line => "City" }
values << [{id: address.id}, {address_field: new_address_field}]
end
Upsert.batch(Address.connection, Address.table_name) do |upsert|
values.each do |p|
upsert.row(p[0], p[1])
end
end
我收到的错误是:
nameError: uninitialized constant PgHstore
答案 0 :(得分:0)
这是upsert和postgresql的问题。 他们的团队正在研究一些事情,但据我所知尚无新闻报道。
https://github.com/seamusabshere/upsert/issues/60
您可以尝试将数据迁移到其他数据库。