0

I´m searching the best way to migrate Firebase Realtime Database Data to Cloud Firestore for a json database with many nested rows. Example:

enter image description here

I found nothing that could help me. For what I need the migration is the new offline functionality of the Cloud Firestore. I´m using Ionic3 (Angular5)

cssler
  • 73
  • 9

1 Answers1

1

Actually there's no standard way to migrate from Firebase Realtime Database to Cloud Firestore, because every application or project has is unique. You have to implement your own way of migrating to Cloud Firestore. But I suggest you read the next tutorials that will help you find the best way for you to migrate:

  1. Cloud Firestore Data Model.
  2. Firestore Data Structure.

Important note: By the way Firebase Realtime Database supports offilne persistence: Enabling Offline Capabilities Realtime Database.

Ameer Taweel
  • 949
  • 1
  • 11
  • 37
  • Thanks! :) But can I start the app without internet connection? I thought the offline persistence works only for apps who already started and loaded the data once from the server. – cssler Dec 26 '18 at 13:06
  • Yes you have to load the data at leas once, and then it gets cached and you can use offline. And it's the same for Cloud Firestore. Realtime Database and Firestore can't invent data for you. They just cache data and load it again when offline. – Ameer Taweel Dec 26 '18 at 13:10
  • If the application is launched when offline and no cached data, you can just show a message to the user telling him to connect to Internet. – Ameer Taweel Dec 26 '18 at 13:12
  • Do you know a solution to build an parallel offline version with syncing automatically when data changed? – cssler Dec 26 '18 at 13:18
  • You can save the data you want to sync offline, and use Firebase to detect connection state as explained in the link bellow, then write the data to the database and getting any new data on the database when getting online. **Detecting Connection State:** https://firebase.google.com/docs/database/web/offline-capabilities#section-connection-state – Ameer Taweel Dec 26 '18 at 13:24