Detecting deleted rows in mysql
0
votes
1
answer
1015
views
I have a Spring Boot webapp with a MySQL database. I'm trying to replicate this data into a MSSQL for running reports against.
All rows are audited with created_at and modified_at datetimes so i can easily fetch new and changed rows. Problem is when a row is deleted this will not be reflected in the target database.
From the top of my head there's a couple of ways to solving this
- Triggers and a "history" table. Whenever there's an update to the table, it inserts a copy of the row and a column describing the action taken.
- A deleted bit. 1 is a deleted row (this will have me redo all queries though, and now i see the advantage of having a class in between the controller and the repository)
- And the very verbose method of querying all rows and check what's missing (will not do)
Is there a *right way* of handling this?
Asked by jared
(123 rep)
Jun 3, 2023, 01:55 PM
Last activity: Apr 17, 2025, 04:10 AM
Last activity: Apr 17, 2025, 04:10 AM