Master and detail question

Hi there,

Im really new to frameworks and Im excited about this one. May be this question is a bit silly but i’d like to know your opinion on how to get this done:

I have an orders table (id, client, contact, io number, etc) and a lines table which is linked to orders one with id field (id, timestamp, start date, end date, product, etc). The thing is that I want to log every change made on lines by avoiding deletion in lines table (once a line is created It will be forever in that table).

Lines table has composite primary unique key (id+timestamp) to be able to select all lines ordered by id/timestamp and have some kind of timeline about what happened to that line.

How would you plan this approach? Am I missing an easier way?

Thank you in advance,

For your requirements this approach seems reasonable. Just would be worth having some convenience functions in the way you retrieve lines. Possibly even have a flag for the current version so you can do a select where “id = x and current = 1”. Little more work to maintain but I reckon it’ll make the reading easier and quicker.