-
Notifications
You must be signed in to change notification settings - Fork 1
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
Practice migration: remove duplicate contacts #2897
base: develop
Are you sure you want to change the base?
Conversation
56ce2ab
to
ab8bca0
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Awesome! 🤩
Quick question for @andrea-williams: Do we need to add a unique constraint to prevent duplicate emails in the operator?
something like:
constraints = [
models.UniqueConstraint(
fields=['email', 'operator'],
name='unique_email_per_operator',
condition=models.Q(operator__isnull=False)
)
]
I don't actually know. Going to loop in @patriciarussellCAS to get her opinion on this. My first question is whether there's a risk to having multiple contacts within the same operator that have the same email? We don't have any restrictions on names, so it's technically possible for industry users to create duplicate contact records for the same person within the same operator. Is that something that we need to be concerned about? I'm not sure. A secondary question is this: if an operator has some sort of generic inbox (e.g., IMO unless there's a solid reason for enforcing unique emails, it's better to leave it as-is and not introduce additional constraints/complexity without reason. |
If we don't enforce a unique email constraint now, we may end up having to clean up duplicate contacts again later. I assume that each email represents a unique point of contact, and by limiting duplicates within the same operator, we allow that email to be used in other operators (in case a user is a consultant or moves from one operator to another). |
right. You've successfully convinced me @Sepehr-Sobhani ! Yes please, let's add in that unique constraint on email per operator! |
I've added the constraint to real ticket (the migration numbers will be out of order by now and this will have to be redone anyway when we go to apply things for real) |
card: https://github.com/orgs/bcgov/projects/123/views/16?pane=issue&itemId=98643893&issue=bcgov%7Ccas-registration%7C2878
This PR: