#172 Add unique constraint for Copr table on User + name
Closed: Fixed 3 months ago by praiskup. Opened 3 years ago by praiskup.

By tweaking one of my downstream scripts, I've been able to create two projects of the same name under the same user.


We should also have an unique constraint on User.username.

I am not sure about this. What about a scenario when you create a project called "foo", then delete it (we don't actually delete, but rather set deleted to True) and want to create "foo" again.

Good point, meeting discussion is required obviously.

This cannot be done with UNIQUE constraint. Maybe with EXCLUDE, but I am not sure if you can use multiple columns.
I am afraid this needs to be done in code.

Metadata Update from @msuchy:
- Issue tagged with: bug

2 years ago

If we changed the Copr.deleted field from boolean to date, we could have an unique constraint for user_id + group_id + deleted + name.

If we changed the Copr.deleted field from boolean to date, we could have an unique constraint for user_id + group_id + deleted + name.

This is an interesting idea. +1

Metadata Update from @praiskup:
- Issue assigned to praiskup

3 months ago

We can actually use the partial unique index, see #1762.

Login to comment on this ticket.

Metadata
Related Pull Requests
  • #1762 Merged 3 months ago