Reply
Member
Posts: 1
Registered: ‎01-27-2021

Any modern way to "save" deleted rows to prevent accidental data loss? (MySQL + Javascript)

Hi,

I am building a project that relies on data that arrives from the internet, thing is there can be modifications in which case I need to delete rows.

This is done automatically by a script, but I want to prevent a case in which all the data is deleted.

I have a few mechanisms to prevent it from happening, but still the fact I have a line that says "Delete everything that is not in this array" scares me.

Is there a way to save those deleted rows somewhere? I saw on stack overflow a solution from 2010 to either create a new table to store deleted rows or add a collum to see if active/inactive, but then I need to modify all the queries to handle it.

Or maybe my best bet is to just create a backup of the table before executing the update method?

New Member
Posts: 1
Registered: ‎04-15-2021

Re: Any modern way to "save" deleted rows to prevent accidental data loss? (MySQL + Javasc

If you add a trigger to save the data in a separate table you do not need to change your application code. You can also check this site.