One line answer
- Write SQL that creates the new table in AppDatabase.java
- Call the add-migration in DB initialization
The code
The problem
In my comic app project (NHViewer), I wanted to add a "bookmark" function to show the last seen page for each comic.
So I need to create a new table for the Room database while keeping the original tables and data in the device.
After some searching, I wrote the above code according to the AppDatabase's schema.
Coda
During my searching, the Room database migration seems improved in the version 2.2.0 (androidx.room:room-*:2.2.0)
This note did not cover that part though 🙁
This note did not cover that part though 🙁
留言
張貼留言