bulkCreate returns invalid records instead of throwing when unique indexes are violated #10809
Labels
breaking change
For issues and PRs. Changes that break compatibility and require a major version increment.
status: awaiting response
For issues and PRs. OP must respond (or change something, if it is a PR). Maintainers have no action
type: bug
Let's say we have a table defined with a unique index that is not the primary key.
Then we create some entries
In the first call to
bulkCreate
we create a record in the db, and there is an id created. However in the next call tobulkCreate
to record is created - due to the unique constraint being violated` but a record like object with dataValues is returned that has everything the first had, but with an id of 0.I'm glad it's not creating the entry in the DB, but this doesn't feel like the right behavior? I think it would make more sense of an error was thrown, or at least return an object that isn't ostensibly a valid row.
I've stepped through the code and see where the bug is and can craft a PR to fix, but wanted to see if throwing an error would be an acceptable way to handle this
Dialect: sqlite
Dialect version: any
Database version: any
Sequelize version: 4.37.6
Tested with latest release: No
The text was updated successfully, but these errors were encountered: