Skip to content

Conversation

@migmartri
Copy link
Member

Take into account the deleted_at column in the uniqueness constraint

Closes #612

Signed-off-by: Miguel Martinez Trivino <miguel@chainloop.dev>
Signed-off-by: Miguel Martinez Trivino <miguel@chainloop.dev>
@migmartri migmartri requested a review from danlishka March 13, 2024 12:00
index.Fields("name").Edges("organization").Unique(),
// names are unique within a organization and affects only to non-deleted items
index.Fields("name").Edges("organization").Unique().Annotations(
entsql.IndexWhere("deleted_at IS NULL"),
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is the important bit

@migmartri migmartri requested a review from tknura March 13, 2024 12:06
Copy link
Member

@danlishka danlishka left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@migmartri migmartri merged commit 09ebb28 into chainloop-dev:main Mar 13, 2024
@migmartri migmartri deleted the fix-soft-deletion branch March 13, 2024 12:31
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

Successfully merging this pull request may close these issues.

make sure uniqueness take into account soft-deleted items

2 participants