My database has certain data that is important for the application to work (constants, ...). And I have test data that is generated by testing the site. Since the test data is consumable, they delete it regularly. Unfortunately, two types of data are found in the same table, so I cannot do it delete from T, but I need to do it delete from T where IsDev = 0.
How can I make sure that I do not accidentally delete non-dev data, forgetting to enable the filter? If this happens, I need to restore from a backup that wastes my time. I will need some kind of foreign key, such as behavior that does not delete deletion when a certain condition is met. It would also be useful to ensure that my code does nothing harmful due to an error.
source
share