0

I was wondering how to make a backup of my sqlite(Room) database. So I have searched on SO and I have found this thread : Backup/restore sqlite db in android

But with this method if I make a backup of my database v1 and try to restore on a phone with database v2 there will be problems. The scheme of the database v1 and database v2 may be different.

Do I have to make a manual backup/restore with JSON?

Ananta
  • 660
  • 1
  • 7
  • 19
  • 2
    You'd (should) have a solid migration which should then kick-in and upgrade the database when it's been restored, converting it to the new schema. Although, you would have to ensure that the database was entirely freed so that it could be opened again by Room. – MikeT Sep 05 '18 at 08:42
  • Thanks so after the copy of the .db file the migrate function will be called by Room? – Ananta Sep 05 '18 at 08:58
  • You'd have to make sure that happens, perhaps restore and then immediately restart the App may be one way. – MikeT Sep 05 '18 at 09:10

0 Answers0