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?

3
  • 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. Commented Sep 5, 2018 at 8:42
  • Thanks so after the copy of the .db file the migrate function will be called by Room? Commented Sep 5, 2018 at 8:58
  • You'd have to make sure that happens, perhaps restore and then immediately restart the App may be one way. Commented Sep 5, 2018 at 9:10

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.