Assume I have the following tables:
- Article (id[PK], home, category, userId[FK], locationId[FK])
- User (id[PK], name)
- Location (id[PK], address, name)
Now I want to create a new ArticleArchive, that will have a snapshot of a certain Article (which itself points to other foreign key tables) and also some new attributes
Now the issue by doing so like this:
ArticleArchive (id[PK], school, country, archiveId[FK])
is that if i’ll make changes/delete the original archive it would also be reflected in ArticleArchive,
Another issue, is that i want also a snapshot of Article’s user, in case the user has changed,
So the only solution i can think about is to take all attributes from Article, and recursively from its foreign key tables as well and just make a big table. I guess this solution is “ok” because it won’t require join tables, but is there more elegant solution to make snapshots?
1