Mark translations as "deleted" instead of actually removing them
This issue was created automatically by a script.
Bug 1599377
Bug Reporter: @adngdb
At the moment, when we want to hide a translation from the UI and API, we delete it from the database. Because we still need to know that something changed on the associated entity, project and locale, we created the ChangedEntityLocale table.
If, instead of deleting the entry, we marked it as deleted, we could do without that table. It would also simplify some of our existing relationships, and would avoid the loss of some data due to links with the translation table.
Doing this however means we will need to rework our queries to the Translation table to exclude deleted translations.
I don't think the quantity of data that this will add will be worrisome but we should still keep that in mind and monitor the size of our table.
Steps
- Add a
deletedboolean field to the Translation model. - Replace all queries to the Translation table to exclude
deleted=True. Add tests to verify that behavior. - Update the
delete_translationmethod to mark as deleted. - Update ActionLog's
translation:deletedaction to link to the translation instead of entity/locale couple. - Update code that uses the
ChangedEntityLocaletable to rely on the Translation table instead. - Remove the
ChangedEntityLocaletable.