I’m hitting an issue I’m quite sure a thousand developers encountered before me: how to keep an ordered collection in an SQL database.
Keeping an ordered collection seems trivial at first, but can soon become quite complicated.
Lets summarize: what we have is a table A, referencing a table B via a foreign key, and we want to keep the B rows belonging to A sorted.