You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
In addition, you have a database level unique index to make sure team and user only have 1 team membership, similar to the validation on team membership.
The following will produce a database not-unique error:
team=Team.find(1)user.teams << teamuser.teams.delete(team)user.teams << team
That doesn't seem like the right behavior. I've solved this with a hack in our code, but I wanted to figure out what other people thought was the right behavior before going further.
Is it:
a. We're stupid for having a unique validation on a soft deleted column. Remove it and just create duplicate team memberships.
b. The error is valid and reasonable because we should have identified and restored the previous record before trying to add a new one.
c. We should find and restore the original team membership instead of creating a new one
The text was updated successfully, but these errors were encountered:
Let's say you have the following setup:
In addition, you have a database level unique index to make sure team and user only have 1 team membership, similar to the validation on team membership.
The following will produce a database not-unique error:
That doesn't seem like the right behavior. I've solved this with a hack in our code, but I wanted to figure out what other people thought was the right behavior before going further.
Is it:
a. We're stupid for having a unique validation on a soft deleted column. Remove it and just create duplicate team memberships.
b. The error is valid and reasonable because we should have identified and restored the previous record before trying to add a new one.
c. We should find and restore the original team membership instead of creating a new one
The text was updated successfully, but these errors were encountered: