Forum OpenACS Development: Best practice for retrieving old version with related items

I am looking for a best practice on how to achieve revisioning with depending objects, so that I can put life an old Budget with all relating BudgetItems at that time.

The example is simple, I have an object "Budget" and multiple "BudgetItems" (rows in a table). The relationship is 1:n, solved using the parent_id of BudgetItems => item_id of the Budget object.

Both Budget and BudgetItems are content_types, and I use ::BudgetItems save to save the Items with a new revision (yes, XoTCL).

When I go back to an old revision of "Budget", how do I find the depending revision_ids of the BudgetItems at that time, so I can fully (and correctly) recreate a version of Budget?

My initial thought was to create a "budget_item_revisions" column for Budget which stores the revision_id of the BudgetItem revisions whenever I call "::Budget save".

But I have the nagging feeling that this problem has been solved considerably better by experts, so I am asking for advise here.

Ah in this case you could use the revision_id of the Budget as the parent_id since any object can be a parent_id in cr_items.
if I use the revision_id of the budget I would be forced to create new budgetItems for each revision of the Budget, though I actually might only change attributes of Budget (generating a new revision), but keep the budgetitems as they were before.

And then I would either have to duplicate the BudgetItems, as I can't have multiple parent_ids. Maybe I should have used acs_rels where a BudgetItem's revision is related to a Budget revision, this way allowing for an n:m relationship.

Thanks for your quick reply Dave.

Do the revisions have timestamps?
Good idea. I could really try it with timestamps. Thanks, I will look into it.