Cloud Firestore backup/restore

137 views
Skip to first unread message

michael griffith

unread,
Mar 5, 2021, 6:27:12 AM3/5/21
to Firebase Google Group
I see there is a way to basically move data through environments using the Firebase/Google export and import functions. 

Docs:
I used this to move data from my dev env to staging, but it didn't move the authentication objects over, which makes some sense since they are not in the CloudFirestore. However, my app has a quite a lot of data hanging on the user profile, which is linked to the authentication objects.  The export/import data did move over the user collection but basically every document in that collection is now orphaned because it doesn't tie back to an authentication object, and there appears to be no way to change the document id through the firebase console.

While this is inconvenient, my greater concern is that if we have some sort of catastrophe when trying to upgrade our app that has a new and improved data model, there is no easy way to roll back the data to a known state that is in sync with the authentication objects.

Is there any work around for this situation?   Thanks in advance for any/all replies.

Best Regards,   
MG

Sam Stern

unread,
Mar 5, 2021, 6:42:13 AM3/5/21
to Firebase Google Group
Hi Michael,

Thanks for asking, this is a good question. Right now there's no "unified" backup for Firebase projects, each individual service has its own backup or export options (where we have them at all).

You can use the Firebase CLI to export and import users from Firebase Auth:
https://firebase.google.com/docs/cli/auth

If you pair that with your Firestore process, you should probably be able to patch together the experience that you want. It's not ideal but I hope it works! I've also seen some third-party services that address this issue, such as backupfire.dev. I haven't used their service and I can't vouch for it (not Firebase official) but it seems to be based on solid principles.

- Sam

--
You received this message because you are subscribed to the Google Groups "Firebase Google Group" group.
To unsubscribe from this group and stop receiving emails from it, send an email to firebase-tal...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/firebase-talk/ea88e137-6479-459b-ae53-5d64265170d3n%40googlegroups.com.

michael griffith

unread,
Mar 5, 2021, 9:51:41 AM3/5/21
to fireba...@googlegroups.com
Thanks Sam.  It seems like a common use case.  Hopefully it's on your roadmap for the future.

Reply all
Reply to author
Forward
0 new messages