如何迁移数据&从一个Firebase设置到另一个? [英] How to migrate data & settings from one firebase to another?
问题描述
我知道你可以从Forge导出JSON和导入JSON,但是不包括授权和安全设置。我们所有的数据都可以通过一个REST API获得,所以你可以很容易地编写一个脚本来自己完成这个任务。您可以通过设置format = export(这包括响应中的所有优先级数据)来导出数据:
curl https: //myapp.firebaseIO.com/.json?format=export&auth=YOUR_FIREBASE_SECRET
至于输出安全规则,你可以在这里访问: .json?auth = YOUR_FIREBASE_SECRET
然后,您可以使用PUT将它们写回新的Firebase。 p>
各种身份验证设置不能自动转移(如授权起源),但它们可能不应该像在分期和生产之间有所不同。 / p>
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.
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.
这篇关于如何迁移数据&从一个Firebase设置到另一个?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!