Validation IsUnique problem with softdeleted item
thiagojeffery opened this issue · 1 comments
thiagojeffery commented
Can´t use IsUnique when there is an item softdeleted, the validation ignore it and the DB return "Error: SQLSTATE[23000]: Integrity constraint violation: 1062 Duplicate entry".
abdulzeedo commented
I would suggest to not use soft delete on tables where the primary key is not generated.
However, you could always check before inserting if there are soft deleted records with the same primary key.
As for the validation, it should not ignore soft deleted records, how would you guarantee primary key uniqueness otherwise?