News for hackers. Stuff that matters.
Re:Ask HN: What are some examples of good database schema de... by KptMarchewa on Friday February 14, 2020 @12:01PM (#22328108)
Never done something regarding invoices and related stuff, so just an academic question: Why not just version the product description and FK to appropriate version?
Re:Ask HN: What are some examples of good database schema de... by snarfy on Friday February 14, 2020 @07:12PM (#22331796)
That's one solution. You could copy the description to the invoice item. That's another. There are a lot more solutions, but the point is none of them will be trivial to implement in a large existing code base. It's really important to get the data model right as much as possible up front. This is a bit counter to all of the agile/scrum rage of iterate and refactor. That works for code, but schemas and data migrations do not lend themselves to constant refactoring.
Re:Ask HN: What are some examples of good database schema de... by gen220 on Friday February 14, 2020 @01:29PM (#22328875)
versioning solves this problem.

in practice, you have to support retroactive changes, so you have to have "middle" values for versions (i.e. 1.1 between 1 and 2).

People are usually interested in the timestamps associated with those versions (for which period of time is this version valid, when was this version created), so in practice it's easier to just keep track of the timestamps, and leave the versions implicit.