refactor(db): rename vm_host_region → region (internal, API stable)#213
Merged
Conversation
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.
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.
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_regionholds 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 (anapp_cluster → vm_host_regionFK felt wrong) or adding a redundant parent table, we simply rename it toregion.What
RENAME TABLE vm_host_region TO region— foreign keys and theregion_idcolumns on referencing tables (vm_host,ip_range, …) are preserved automatically.VmHostRegion→Region, and all internal SQL/type references updated.ApiVmHostRegionand the admin region endpoints keep their names/shapes (they now map from the renamedRegionstruct). No client-visible change, no API_CHANGELOG entry.get_host_region, …) intentionally left as-is to keep the diff focused; they now returnRegion.Pure rename, no behaviour change. Full workspace builds; all
lnvps_dbandlnvps_api_commontests pass.Follow-up:
app_cluster.region_id → regionin the App Deployments work.