Realm Mapping
This document is made for the sole purpose of migrating a realm from one environment to another. Please follow the steps precisely to avoid any errors.
- 2 realms in 2 different environments (one in each of them). Ex- You need to migrate from pre-production to dedicated pre-production i.e. UAT .
- The 2 realms should be made through api.
- The realm in which you have to migrate , the realm should be newly created and please do not do any kind of config movement or flow based movement before following the below steps.
- You will need a Devops/Infra Member who has access to the db of both the environments. (To run the database queries).
Let's take an example that you want to migrate from pre-production to UAT
- Run the following query to find out the _id of both the realms(pre-prod & UAT) , and save the object of the realm of UAT in a doc or text-editor . You have to keep the whole object of the realm until step 3 is executed.
db.Application.findOne({realm:"realm name"}).pretty();
- Let the _id(pre-prod) = x and _id(UAT) = y. Now you have to run a delete query in the UAT environment db .
db.Application.deleteOne({_id:ObjectId("y")});
- Now in the object that you saved in a text-editor , change the _id of the UAT object from “y” to “x” and Run the following query.
db.Application.insertOne(Paste your Object of UAT here);
- Now after the above step you have to update the applicationId of DashboardCreator (which was “y”) to “x”. To do this run the following query
db.DashboardCreator.updateOne({applicationId:ObjectId("y")},{$set:{applicationId:ObjectId("x")}});
- Now after the above step you have to update the applicationId of BackopsUser(which was “y”) to “x”. To do this run the following query
db.BackopsUser.updateOne({applicationId:ObjectId("y")},{$set:{applicationId:ObjectId("x")}});
- After this you have to insert an object which references signzyAppId . To do this run the following query.
db.SignzyAppId.insertOne({_id:ObjectId("x"), signzyAppId:1000000});
This completes the process of migration of a realm from one environment to another. After this you need to do the version movement from pre-prod to UAT.