New to Realm : upgrading from realm database to realm platform?


#1

I’m new to realm and I want to use it offline first and have the possibility to sync it online after with the $30 plan.

So what I understand is the realm database is an offline and free database (same job as CoreData).
And the realm platform is a realm database which is synchronized on the cloud.

My question : is it possible to build an app with realm database and later migrate this database on realm platform to move the database online ?


#2

Yes, of course.
Note: there is no local-to-cloud conversion. So, when you want to sync your database, then you need to create a synced realm and copy all of your current data to there. Otherwise it working fine.


#3

Ok but if I distribute an iPhone app which contain the realm offline database, is it possible to release an update of this app to sync all my customers realm database to the realm cloud ?


#4

Yes.
1.) Release an app with local realm. There will be a realm file in the storage, with the user data.
2.) a.) Write the new app version.
b.) Write this function (pseudo code):
- open the local realm (you have the code for that from the previous version
- create a new, synced realm (new code)
- copy all data from local realm to synced realm (you have the local models, you can get access to them. ). It will be synced to the cloud, as the copied data are “new” [its new in the synced realm]
- delete local realm [free the storage]
- test,test,test
- test
- enjoy :slight_smile: