Move cluster geo_json to GeographicalInformation#1378
Open
Zhey-on wants to merge 1 commit intoEnAccess:mainfrom
Open
Move cluster geo_json to GeographicalInformation#1378Zhey-on wants to merge 1 commit intoEnAccess:mainfrom
Zhey-on wants to merge 1 commit intoEnAccess:mainfrom
Conversation
3 tasks
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.
Closes #1261
Summary
This PR moves cluster geometry storage from
clusters.geo_jsontogeographical_informations.geo_json, makingGeographicalInformationthe source of truth for cluster map data while preserving the existing API contract that still exposescluster.geo_jsonto the frontend.This keeps the current frontend behavior intact, but aligns cluster geo data with the broader data-model consolidation described in #945.
Why this change
Issue #1261 points out that cluster geo data is inconsistent with the rest of the model structure because it is stored directly on the
clusterstable.By moving that payload into
GeographicalInformation, cluster geometry follows the same ownership pattern already used elsewhere and becomes easier to evolve without keeping location data split across multiple places.What changed
geo_jsontogeographical_informationswhen missing,clusters.geo_jsonvalues into relatedgeographical_informationsrecords,GeographicalInformationrows for clusters that already have geometry,clusters.geo_jsoncolumn after the migration.clusters.geo_json, copies data back fromgeographical_informations, and removes the new relation column.location()morph-one relation onCluster.geo_jsonaccessor onClusterand appended it to serialization so the API response shape remains backward compatible.geo_jsoncasting onGeographicalInformation.ClusterServiceto:GeographicalInformation,geo_jsoninput.ClusterFactory,ClusterSeeder, andAgentSellApplianceTestso they work safely before and after the migration and populate cluster geometry through the relation.clusters.geo_jsononly while that column still exists, which allows the code to run safely across pre-migration and post-migration states.Compatibility notes
cluster.geo_jsoncontinue to work.geographical_informations.geo_json.Validation
I validated the change in the local Docker environment with the following checks:
docker compose exec -T backend-dev php artisan migrate-tenant:drop-demo-companydocker compose exec -T backend-dev php artisan migrate:fresh --seedclusters.geo_jsonis no longer presentgeographical_informations.geo_jsonis presentgeo_jsonthrough the relatedlocationGeographicalInformationrecords with geometryTest note
I also ran:
docker compose exec -T backend-dev php artisan test tests/Unit/AgentSellApplianceTest.phpThat test currently fails because it expects HTTP
201, while the endpoint onmainalready returns the default200response fromApiResource. The failure is therefore pre-existing and not introduced by this refactor.