0
Rails 5允许使用UUID作为主键。我最近从Rails 4迁移到了5,并希望利用此功能。我现在的表有两个UUID和序列ID:Rails 5 - 迁移到使用UUID作为主键
schema.rb:
create_table "customers", id: :serial, force: :cascade do |t|
t.uuid "uuid", default: -> { "gen_random_uuid()" }, null: false
# other stuff...
end
什么会迁移样子摆脱的id和UUID设置主键?
你有其他表指向'users.id'(又名:'belongs_to:user')的外键吗? – spickermann