Refactor Domain PK from name to UUID
- Dominant language
- Python
- Stars
- 670
- Forks
- 183
- Avg merge
- 17h 7m
- Merged PRs (30d)
- 358
Description
Background
The `domains` table currently uses its `name` column (VARCHAR) as the primary key. This forces every FK reference and external identifier across the codebase to carry a string name, which makes renames impossible, leaks user-visible names into internal data structures, and complicates RBAC scope handling.
This epic introduces a UUID `id` column to the `domains` table, demotes `name` to a unique constraint, and incrementally migrates downstream layers (API, FK columns, RBAC) to the new identifier.
Sub-stories
D-1: Add UUID `id` column, update ORM/Alembic, add DomainID identifier
D-2: Expose `id` in APIs and migrate identifier from `name` to `id` (REST, GraphQL, SDK, CLI)
D-3: Migrate FK references from `domain_name` to `domain_id` across 9 referencing tables
D-4: Migrate RBAC data and `DomainScope`/scope_binder/permission context logic to `domain_id`
Dependency
1 must merge first; 2, 3, 4 can proceed in parallel afterwards (recommended order 3 → 4 to keep RBAC mapping consistent with FK state).
Related
ScalingGroup track was split into BA-6145.
JIRA Issue: BA-6043
Contributor guide
Assessment
This issue has not been assessed yet.