👨🏼💻Migrate Firebase Realtime database to Firebase Firestore(Android / Kotlin)
Before you start:
Check the ‘Realtime database vs Firestore’ article link below and make sure about whether you should make migration or not.
Introduction:
In this article , I will be talking about how I migrated my Firebase Realtime database to Firebase Firestore.
1) I exported my Realtime database:
2) Helper class for migrating Realtime database to Firestore:
3) Reading json file method:
4) Reading json file and passing to my helper class:
Important note: I used coroutines for creating asynchronous threads for reading json file and migrating Realtime database to Firestore, you can use other asynchronous methods!
Also I called this method on my application class and you only need to call once, after migration you can delete or comment this code block!
5) Output:
Migrated into ->
6) Conclusion:
In this article I tried to give information about migrating Firebase Realtime database to Firebase Firestore. Since our database designs are different so the approaches and the codes can be different. So I hope this article give you some insights and ideas how can you do it. Happy coding :)
References: