We've moved discussions to Discord

UUID for all or just select records

cg5544
This is more of an opinion question.
 We need to use UUID for two resources, project and user.I was wondering if we should implement UUID on all resources or just the ones that we need. What's the community's opinion on this? 

Chris Oliver
UUID adds some complexity since it's not sortable, so you'll have to make adjustments for that as well.

I personally don't use UUIDs as primary keys, but I'll add them as a separate column if I need one on a model.
cg5544
Chris Oliver I see. Thanks for sharing. 

If you don't use UUIDs as primary keys and have them as a separate column, the resource URLs are still using sequential IDs, right? 
Chris Oliver
Most of the time I'm using like https://github.com/jcypret/hashid-rails so that it's not just a plain database ID in the url.

Check out this for using UUIDs as primary keys: https://pawelurbanek.com/uuid-order-rails
Romain Manguin
I think that a PR has been merged in Rails 6 to fix ordering issue with UUIDs. You just have to add self.implicit_order_column = "created_at" to your model. https://github.com/rails/rails/pull/37626
Notifications
You’re not receiving notifications from this thread.