Update positioning code to support edge cases
In !48120 (merged) we created a new table boards_epic_board_positions
. We didn't add any data there and we should make sure that the positioning of epics in epic boards still works.
In #247867 (closed), it was mentioned that we would just do a LEFT JOIN
and then order by nulls last.
The problem here is with setting positions when an Epic is dragged. For example we currently have a list of Epics with the following positions:
1 5 10 NULL NULL NULL NULL NULL
And we want to add a new issue between the last 2 NULLs. To do that, we need to also set the positions of all epics before the last NULL.
Our current relative positioning code does not handle this case. You would probably have to call move_nulls_to_end
on the objects that appear before the position we want to insert. That is why for issue boards we ensure that there are no nulls when the board is loaded.
Also, another edge case is when an epic disappears from the board because a label is changed, etc.. The position record would still remain. But I think that's fine and also useful if the user adds it back to the board.