lablup / lablup/backend.ai

[Domain] Move routings.domain FK to routings.domain_id

Open
#11,722 0 comments 0 reactions 0 assignees View on GitHub
Dominant language
Python
Stars
670
Forks
183
Avg merge
15h 13m
Merged PRs (30d)
368

Description

Goal

Move the foreign key reference from ``routings.domain`` (string, → ``domains.name``) to a new ``routings.domain_id`` (UUID, → ``domains.id``). The legacy ``domain`` string column is retained without a FK constraint; removal is deferred to BA-6122. ``domains`` keeps ``name`` as PK in this story — the PK swap is BA-6046.

Scope

1. Alembic: single revision, parent ``down_revision = fdc9d6ac49b4``. Add ``routings.domain_id`` UUID column (NOT NULL). Backfill via join on ``domains.name``. Drop legacy ``domain → domains.name`` FK (``ON DELETE RESTRICT``); create new ``domain_id → domains.id`` FK with the same ``RESTRICT`` semantics. Downgrade reverses.

2. ORM: add ``domain_id: Mapped[DomainID]`` on ``RoutingRow``; keep ``domain`` column (drop only its FK clause).

3. Create / update specs: add ``domain_id: DomainID`` to ``RouteCreatorSpec`` in ``repositories/deployment/creators/route.py``. ``build_row`` populates both columns.

4. Internal sokovan callers that build ``RouteCreatorSpec``: ``sokovan/deployment/strategy/rolling_update.py`` and ``sokovan/deployment/executor.py``. Source ``domain_id`` from ``deployment.metadata.domain_id`` (added by BA-6127).

5. Tests: update fixtures that construct ``RoutingRow`` directly so ``domain_id`` is populated.

Parallelism

Coordinates with BA-6127 (endpoints) via ``DeploymentMetadata.domain_id``. Independent of the other 8 stories.

Out of scope

- ``domains`` PK swap — BA-6046.

- Legacy column drop — BA-6122.

JIRA Issue: BA-6129

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.