2

During usage the realm database is working great but I noticed during an update of my application from the play store the data I had from my previous version was wiped. Heres what happened:

I made some UI changes to the app, so the realm schema never changes (that is I never changed my database objects. I also don't have any migration code in my app right now since I don't think I need it, not making changes to database objects like I mentioned). I then went through the updating process for Google play, correct me if I'm doing anything wrong here:

  1. I went to project structure and up'd the version number from etc. 3 to 4.
  2. I then switched to release mode and built a new generated signed apk.
  3. I uploaded the apk to the release modules in the play console menu and then continued with the process to release the app.

After waiting a few hours for my update to go live in the store, when I downloaded the update it wiped the database again.

Confused as to whats cuasing this because from what I've seen in the forums, realm is supposed to stay even after IOS and Android updates?

Thanks for the help!

Phantômaxx
  • 37,901
  • 21
  • 84
  • 115
ZarifS
  • 467
  • 1
  • 11
  • 20
  • what version of Realm do you use? – Mike Oct 22 '17 at 21:39
  • this is what i see in gradle file "io.realm:realm-gradle-plugin:3.1.4" – ZarifS Oct 23 '17 at 02:15
  • 1
    have you set the `deleteIfMigrationNeeded` in your `RealmConfiguration`? – beeender Oct 23 '17 at 03:09
  • You've probably set `deleteIfMigrationNeeded()` on your RealmConfiguration – EpicPandaForce Oct 23 '17 at 11:45
  • If you didn't change the version of Realm & didn't change the schema, then I don't see why `deleteIfMigrationNeeded` should be triggered (even if I suppose you've set it before) ... how are you checking that the Realm is wiped out? can you pull the Realm file using `adb pull` and observe it with the RealmBrowser (or Realm Studio) to make sure it's not empty – Nabil Hachicha Oct 24 '17 at 11:58
  • I don't have any realm configuration code in my app or migration. I just get a default instance of realm. The way i know it gets wiped is because the app shows a list of items, and it keeps it persistent and works fine but after a app update it was resetting it. I tried it again with the newer realm version and it seems to have fixed the bug. I'll update if it occurs again. Thanks! – ZarifS Oct 24 '17 at 14:01

0 Answers0