Reputation: 389
When I upgrade my Database from Version 1 to Version 2 and insert new data then all old data stored in Version 1 of database were deleted and I can see only newly inserted data in database.
Any idea how to persist data while upgrading database with Room Library?
Upvotes: 1
Views: 1393
Reputation: 389
I found solution from the same link. And when the migration class is not provided then Room Library deletes whole Database with data on onUpgrade() and create Database again.
It is compulsory to provide Migration class if you want to persist data on onUpgrade()
Upvotes: 1