Added by gmbnomis over 1 year ago
Avoid superfluous RepositoryContent records
When adding and removing the same content in a repository version, don't update the RepositoryContent record (resulting in an superfluous RepositoryContent for which version_added == version_removed == current version). Instead, just delete the existing record. This fixes two problems:
- Such content is shown as added and removed.
- Re-adding the content again in the same version leads to a IntegrityError because the uniqueness constraint is violated.
Handle the "remove then re-add" case analogously.