What is the best way to track order in a model? For example, maybe the user can reorder items in a todo list.
I’ve thought of including a field called “order” or something, but then I’d have to update every single one when I change the order. I’ve also thought of specifying the “order” as a number in the thousands, and just halve the difference whenever something is inserted between something else.
I could try to create some kind of linked-list in the database (so, specify “nextItem” and then update them accordingly), but that’s kind of hacky.
One other idea is to have a separate model that tracks the order somehow.