Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Validation IsUnique problem with softdeleted item #34

Open
thiagojeffery opened this issue Jun 6, 2018 · 1 comment
Open

Validation IsUnique problem with softdeleted item #34

thiagojeffery opened this issue Jun 6, 2018 · 1 comment

Comments

@thiagojeffery
Copy link

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
Copy link

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?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants