Skip to content

Teams: make team names unique per organization - #174

Merged
GoddeyUwamari merged 1 commit into
mainfrom
fix/teams-name-unique-per-organization
Oct 5, 2026
Merged

GoddeyUwamari merged 1 commit into
mainfrom
fix/teams-name-unique-per-organization

Conversation

@GoddeyUwamari

Copy link
Copy Markdown
Owner

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.

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>
@vercel

vercel Bot commented Oct 5, 2026 •

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated
devcontrol Ready Ready Preview Oct 5, 2026 5:06pm UTC

@GoddeyUwamari
GoddeyUwamari merged commit c0801dc into main Oct 5, 2026
6 checks passed

This branch was successfully deployed

1 active deployment
Preview — 8feb5f60 Deployed Oct 5, 2026 by vercel[bot]
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