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

Add database constraint to limit one of the same team member to a single project #21292

Open
mddilley opened this issue Feb 26, 2025 · 1 comment

Comments

@mddilley
Copy link

Since one project team member can have multiple roles, we no longer need to support the ability to add multiple of the same team member per project. We are making front end changes to limit options presented in a project's team table to only people who are not already added to the project, but we should add a constraint in the database to prevent it from happening through other mechanisms in the future.

There are a handful of projects that will need data cleanup to unblock the new constraint that can be observed with the SQL below.

In Scope

  • Update the moped_proj_personnel table with a new constraint to make sure only unique combinations of project and user IDs can exist in the table
  • Clean up existing duplicate records so that the remaining personnel have all roles captured in duplicates
SELECT
    project_id,
    user_id,
    COUNT(*) as duplicate_count
FROM
    moped_proj_personnel
WHERE is_deleted = FALSE   
GROUP BY
    project_id,
    user_id
HAVING
    COUNT(*) > 1;
@mddilley
Copy link
Author

@frankhereford Thanks for suggesting this cleanup in refinement today 🙏

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

No branches or pull requests

1 participant