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

Use objection-unique with objection-soft-delete #13

Open
ravipatelopenxcell opened this issue May 10, 2018 · 2 comments
Open

Use objection-unique with objection-soft-delete #13

ravipatelopenxcell opened this issue May 10, 2018 · 2 comments

Comments

@ravipatelopenxcell
Copy link

I have used "objection-soft-delete" package for soft delete data. I want to handle "objection-unique" with "objection-soft-delete". Currently, it's will also check deleted data.

@nunorafaelrocha
Copy link
Collaborator

Hi @ravipatelopenxcell, that's a common problem when using soft delete strategy.

If you state that an entity is soft-deleted and you re-assign the same "unique" field you may face data integrity issues - for instance, if you "undelete" the entity.

I would say our current approach it's correct one. An entity field that it's unique should always be unique (and it should have that constraint on the database as well). If you want to re-assign a field then I believe that you should handle that field on the soft-delete action.

@mits87
Copy link

mits87 commented Apr 24, 2020

Hi,
actually if we check more advanced packages like Rails ActiveRecord and the Paranoia gem (for soft deletion) then there is a possibility to validate uniqueness of field with NULL or not NULL value.

I think is a common case and it should be supported.
Cheers.

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

No branches or pull requests

3 participants