in SQL, or Django ORM, what's the conventional way to have an ordered one-to-many?

前端 未结 5 562
暗喜
暗喜 2021-02-06 07:12

Say I wanted to have a project, and one-to-many with to-do items, and wanted to re-order the to-do items arbitrarily?

In the past, I\'ve added a numbered order field, a

5条回答
  •  庸人自扰
    2021-02-06 07:44

    I've run into this so many times that I've settled on managing these dynamically in the BL or UI, and then just persisting the ordering to a purpose-built column once the user is happy. SQL is just intentially designed not to handle orderings, and it always fights back.

提交回复
热议问题