Repository navigation
Teams: make team names unique per organization - #174
Merged
Merged
Conversation
A team name was unique across every organization (teams_name_key UNIQUE (name)), so one organization creating a team blocked every other organization from using that name. Uniqueness is now scoped to the organization: teams_organization_id_name_key UNIQUE (organization_id, name). The migration is administrative (teams is postgres-owned in production) and adds the new constraint before dropping the old one, inside the runner's per-migration transaction. The create handler answers 409 for either constraint name, so the code can be deployed before the migration is applied. Any other unique violation is still a 500, and no lookup is added: the database decides. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
This branch was successfully deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Changes team-name uniqueness from global UNIQUE (name) to UNIQUE (organization_id, name) via an admin-track migration (teams is postgres-owned). The controller returns 409 for duplicates under either constraint name, so the code deploys first and the migration runs manually afterwards. Production preflight: 1 team, 0 duplicates, 0 null organization_id.