Rails 5.2 至 6 升级
create_table :logs, id: :uuid do |t|
t.uuid :trackable_id, null: false
t.string :trackable_type, null: false
t.uuid :owner_id, null: false
t.string :owner_type, null: false
t.string :key, null: false
t.hstore :parameters, null: false, default: {}
t.datetime :created_at
end
但是迁移失败说
rails aborted!
StandardError: An error has occurred, this and all later migrations canceled:
can't quote Hash
这个补丁是什么
最佳答案
尝试用引号将空散列括起来:
t.hstore :parameters, null: false, default: "{}"
关于ruby-on-rails - 迁移失败无法引用哈希值,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/60527053/