DB values are not retaining if I change branch

0
Hello team,    In my app, while working in different branches, when I am trying to switch to one branch to another branch my db data is not getting retained? How should I solve this, because I have to feed the data all time again to work with data?
asked
3 answers
1

When you say your data is not retained, I assume you mean it doesn't turn up in the new branch. 

With that assumption you can simply copy/replace the data folder from the ..."YourAppBranch1"/deployment folder to ..."YourAppBranch2"/deployment folder. 

When you rerun the app, your data should be there. 

answered
1

An alternative way to use the same data is by storing a snapshot (Version Control | Add snapshot of data). If you have a snapshot and create a branch, this is copied. If you then load the branch for the first time, the snapshot is used to create your database.

Be aware, if you create a new snapshot, this is not used when you update an environment. Only if running the application cannot find a database, it will create one based on the stored snapshot.

If you want to use a new snapshot for an existing environment, you will need to remove the database.

In a local environment this is easy, You can delete ..app/deployment/data folder and rerun the app, or extract the snapshot and overwrite your data folder

See this section for more info.

answered
0

You could install a local instance of Postgres on your machine and point the database for each branch to it. 

 

The instructions on restoring a backup locally give some instructions on how to set up your Studio Pro to do this. In your case, just skip the restore part, but make sure you create the local database before running Studio Pro. The tables should be created when you start Studio Pro.

 

https://docs.mendix.com/developerportal/operate/restore-backup-locally/

 

I hope this helps.

answered