Skip to content

refactor(db): rename vm_host_region → region (internal, API stable)#213

Merged
v0l merged 1 commit into
masterfrom
refactor/rename-region
Jul 24, 2026
Merged

refactor(db): rename vm_host_region → region (internal, API stable)#213
v0l merged 1 commit into
masterfrom
refactor/rename-region

Conversation

@v0l

@v0l v0l commented Jul 24, 2026

Copy link
Copy Markdown
Contributor

Why

Prep for the App Deployments epic. Apps will run on shared Kubernetes clusters and need a location + billing anchor (which company charges the deployment), but they must not depend on VM infrastructure. Today that anchor is vm_host_region.

Key observation: vm_host_region holds only {id, name, enabled, company_id} — a neutral location+company row with zero VM-specific columns. It's already the shared concept, just named after its first consumer. So instead of overloading it (an app_cluster → vm_host_region FK felt wrong) or adding a redundant parent table, we simply rename it to region.

What

  • Migration: RENAME TABLE vm_host_region TO region — foreign keys and the region_id columns on referencing tables (vm_host, ip_range, …) are preserved automatically.
  • Struct/type: VmHostRegionRegion, and all internal SQL/type references updated.
  • Public API unchanged: ApiVmHostRegion and the admin region endpoints keep their names/shapes (they now map from the renamed Region struct). No client-visible change, no API_CHANGELOG entry.
  • DB trait method names (get_host_region, …) intentionally left as-is to keep the diff focused; they now return Region.

Pure rename, no behaviour change. Full workspace builds; all lnvps_db and lnvps_api_common tests pass.

Follow-up: app_cluster.region_id → region in the App Deployments work.

vm_host_region holds only {id, name, enabled, company_id} — a neutral
location + billing anchor with no VM-specific columns. Rename the table to
`region` and the struct `VmHostRegion` -> `Region` so non-VM resources
(upcoming app deployments) can share the same location concept without
depending on VM infrastructure.

- Migration RENAME TABLE vm_host_region TO region (FKs + region_id columns
  are preserved automatically).
- Struct + all internal SQL/type references renamed.
- Public API kept stable: ApiVmHostRegion and the admin region endpoints are
  unchanged (they now map from the renamed Region struct). No API change.
- DB trait method names (get_host_region, ...) left as-is to keep the diff
  focused; they now return Region.

Pure rename, no behaviour change.
@v0l
v0l merged commit ba61c21 into master Jul 24, 2026
8 checks passed
@v0l
v0l deleted the refactor/rename-region branch July 24, 2026 11:52
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