Closed
Description
Describe the bug
When using bulk_create_with_history
, if there is an item that is a duplicate (either created earlier in the same batch or already existing in the database) the returned object includes both the newly created and the existing duplicated object.
In addition, history will be generated for both items, even though only the newer item should have generated history. This will happen multiple times if the duplicates are created in the same batch.
In summary:
If a duplicate item already exists in the database:
- All duplicate items will be returned
- History will be generated for all duplicate items
To Reproduce
- Use a database which doesn't return ids
- Save an object to the database
- Create duplicate object(s) using
bulk_create_with_history
- Inspect returned result and historical entry
Expected behavior
- Only items that were created should be returned
- Duplicated objects that were not created should not be returned
- History should be generated only for objects that were created
Environment:
- Django Simple History Version: 3.0.0
- Django Version: 3.2.15
- Database Version: MySQL 8.0.29
Metadata
Metadata
Assignees
Labels
No labels