pontoon icon indicating copy to clipboard operation
pontoon copied to clipboard

Mark translations as "deleted" instead of actually removing them

Open bugzilla-to-github opened this issue 6 years ago • 0 comments

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

  1. Add a deleted boolean field to the Translation model.
  2. Replace all queries to the Translation table to exclude deleted=True. Add tests to verify that behavior.
  3. Update the delete_translation method to mark as deleted.
  4. Update ActionLog's translation:deleted action to link to the translation instead of entity/locale couple.
  5. Update code that uses the ChangedEntityLocale table to rely on the Translation table instead.
  6. Remove the ChangedEntityLocale table.

bugzilla-to-github avatar Nov 25 '19 17:11 bugzilla-to-github