I want to keep track of when a user did something such as update a record. A given record might have several related tables etc. Im considering two approaches
(1) A common table such as this, which the application(s) write to when some event takes place
UserActivityLog
==========
logid
userid
action_type_id
action_notes
pros:
- can capture more than the most recent event.
cons:
-if the application is changed in some way, there would be no requirement to populate the 'UserActivityLog'
(2) Add columns to a few of these key tables, such as
last_update_by
last_uddate_date
pros:
-make the columns not nullable and save this data on each update/insert, it will allways be there
cons:
- only captures the most recent action and who done it.
Now that I typed all that out, I think I see it not as either/or. (1) is more of a transaction log, whereas (2) is a way to simply capture when the last update to a given table was made.
I might end up use both, since I will want history as when a table was last updated and by who.
thoughts?