How do I store orders?

后端 未结 6 710
太阳男子
太阳男子 2020-12-08 03:23

I have an app which has tasks in it and you can reorder them. Now I was woundering how to best store them. Should I have a colomn for the ordernumber and recalculate all of

6条回答
  •  渐次进展
    2020-12-08 04:06

    I'd recommend having an order column in the database. When an object is reordered, swap the order value in the database between the object you reordered and the objects that have the same order value, that way you don't have to reoder the entire set of rows.

    hope that makes sense...of course, this depends on your rules for re-ordering.

提交回复
热议问题