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

Ensure user cannot be assigned to more than one person #1331

Merged
merged 3 commits into from
Dec 17, 2024

Conversation

moveson
Copy link
Collaborator

@moveson moveson commented Dec 17, 2024

Currently, the Person model includes a belongs_to relationship with the User model, and the User model includes a has_one relationship with the Person model. But nothing is currently enforcing uniqueness of user_id in the people table.

This PR adds both a unique index and a validation to ensure uniqueness of user_id on the people table.

@moveson moveson merged commit 7423a7a into master Dec 17, 2024
3 checks passed
@moveson moveson deleted the oveson/unique-index-on-people-user-id branch December 17, 2024 16:41
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.

1 participant