Hello Team,
We have recently completed a full migration of our CommCare HQ environment from the Dimagi cloud to a self-hosted local server infrastructure. We are now in the final stages of our deployment, but we have encountered a structural linking issue with our linked applications.
Setup & Context:
-
Production Domain Space:
mc-inscale(contains two linked applications: aplicativo do APS and aplicativo do supervisor). the client wants to maintain and continue to use all the versions that are part of the downstream applications -
Development Domain Space:
mc-inscale-dev(contains the active source applications: aplicativo do APS and aplicativo do supervisor). The development space was copied down to our new local server, which generated new application IDs on the local instance. -
Client Requirements:
-
The client needs to maintain and continue to use all historical versions that are already part of the downstream applications.
-
Future updates should flow seamlessly from the newly established local development space (
mc-inscale-dev) to the production space (mc-inscale).
The Issue:
We successfully established a project space link from mc-inscale-dev β mc-inscale by name, and the Linked Project Spaces pages correctly show them linked to each other on our local server.
However, the individual linked applications are still pointing to the legacy Dimagi cloud upstream_app_id from before the migration rather than the new local app IDs generated when the dev space was copied down.
When inspecting via the Django shell (./manage.py shell), we verified the following:
from corehq.apps.app_manager.dbaccessors import get_app
app = get_app("mc-inscale", "c2161fa6d8bded80ecad5edd91582e32") # (aplicativo do APS linked)
print(app.doc_type, app.upstream_app_id, app.upstream_version)Output:
LinkedApplication 240a8a42523112581841db1c0f15fd9e 5918
The upstream_app_id (240a8a42523112581841db1c0f15fd9e) still maps to the old cloud ID instead of the new local application ID residing in mc-inscale-dev.
Question:
What is the recommended method or management command to safely update or remap the upstream_app_id of an existing LinkedApplication to point to the new local development app ID without breaking sync functionality or release histories?
Any guidance or python snippet to handle this mapping update cleanly in the DB would be greatly appreciated.