Answer the question
In order to leave comments, you need to log in
Allow only INSERT in the table for the purpose of logging events?
There is a table ScheduleTest , in which (via the web-face, of course) power engineers in different cities set a schedule for switching on and off street lighting.
There was a task about logging of actions of users in this table.
How good is the next idea? We prohibit UPDATEs and DELETEs. If the user deletes or changes the schedule for a certain date in the web interface, then the record with this date is marked in the active 0 field and a new record is made in the table with this date. When creating a new schedule, the active field is set to 1 by default. As a result, we have access to the entire schedule change history in the schedule worksheet.
ts– the time of the event on the WEB server (for example, deletion or change of the schedule for a certain date),
created – the time the record was created in the table.
My eye blurred. Need a fresh perspective.
Answer the question
In order to leave comments, you need to log in
I would store the current state of the record (actual) in ScheduleTest, and put the log into a separate table and fill in this table with any change in the record through the trigger, at the output we get a full log of changes.
All the same, for logs it is better to make a separate table on INSERT and that's it.
And from your approach in the schedule table, 10 entries will be with active=1, and 90 with active=0
All garbage, the main maneuvers. Read about event log based on CQRS pattern and stop interfering with log data
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question