Story
I'm going to write code to manage deleted items in my application, but I'm going to delete them so that I can get them back when I need to. I have a hierarchy to respect in my application logic when it comes to hiding or deleting elements.
I logically place my items in three containers per country, city, district and brand. Each item must belong to a country, city, district and brand. Now, if I delete a country, it must remove the cities, districts, brands and objects belonging to that country. and if I delete a city, it should also delete all the material under it (areas, brands, etc.).
Note
When I delete a country and delete related brands, I must make sure that the brand can have elements in more than one country.
Question
You suggest
Mark the elements (whether it is a country, city, element, etc.) as deleted, and this will require a lot of code to check every time an element is loaded from the database, if it is deleted or not, as well as some additional fields for marking if the city to which it belongs is deleted, and the country to which it belongs is deleted, etc.
Move the deleted material each to a specific table (remote countries, remote cities, etc.). and save the identifiers of the elements with which it was associated, so that I can insert them later in the source table. and of course, this will save my application in all the code, which will check all the deleted items and make sure that the entire hierarchy is deleted.
Perhaps you have a better approach / advice / idea to achieve this!
lKashef
source share