Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to migrate data & settings from one firebase to another?

Tags:

firebase

Are there any tools to aid in data migration from dev to staging to prod? If not, are there plans to build them?

I know you can Export JSON and Import JSON from Forge, but that doesn't include authorization and security settings.

like image 512
sprugman Avatar asked Mar 21 '13 13:03

sprugman


People also ask

What is data migration process?

Data migration is the process of moving data from one location to another, one format to another, or one application to another. Generally, this is the result of introducing a new system or location for the data.

What is data migration with example?

Data migration is the process of transferring data from one storage system or computing environment to another. There are many reasons your enterprise might need to undertake a data migration project. For example, you might be replacing servers or storage devices or consolidating or decommissioning data center.


1 Answers

All of our data is available through a REST API, so you could easily write a script to do this yourself. You can export the data by setting format=export (this includes all of the priority data in the response):

curl https://myapp.firebaseIO.com/.json?format=export&auth=YOUR_FIREBASE_SECRET

As for exporting the security rules, you can access them here:

curl https://myapp.firebaseIO.com/.settings/rules/.json?auth=YOUR_FIREBASE_SECRET

You can then write them back to the new Firebase using PUT.

The various Auth settings can't easily be automatically transferred (such as the Authorized Origins), but they probably shouldn't be as they'll differ between staging and production.

like image 169
Andrew Lee Avatar answered Oct 25 '22 03:10

Andrew Lee