How to track history of db tables that include many-to-many mapping tables?
Posted
by chacmool
on Stack Overflow
See other posts from Stack Overflow
or by chacmool
Published on 2010-04-06T21:36:19Z
Indexed on
2010/04/07
4:03 UTC
Read the original article
Hit count: 296
database-design
|versioning
I have seen several questions here on tracking db history, but can't seem to find one that matches our situation. We need to track the history of several tables, some of which are many-to-many linking tables. Eg say we have this schema:
EntityA
id
name
EntityB
id
name
ABLink
A_id
B_id
So, tracking changes to EntityA or EntityB seems pretty straightforward. We can keep a log table with the same columns plus a date stamp and user. But what about the links? How do we maintain the set of links that are valid for a given version of the data? We need to be able to recreate a history of the data showing changes in chronological order. So if a link added or deleted, we indicate that. Etc.
© Stack Overflow or respective owner