Migrating an existing SQL database to room
As we mentioned earlier, Room does harness the power of SQLite, and because many applications still use legacy, you might find applications still using SQL and be wondering how you can migrate to Room and utilize the latest Room features.
In this recipe, we will cover the migration of an existing SQL database to Room with step-by-step examples. Furthermore, Room offers an abstraction layer to help with SQLite migrations – that is, by offering the Migration
class to developers.
How to do it…
Because we did not create a new SQLite database example, since that is not necessary, we will try to emulate a scenario with a dummy sample SQLite database and showcase how you can migrate your existing SQLite database to Room:
- Since we will be adding Room in an existing SQLite project, you will need to ensure you add the required dependencies. To set this up, refer to the Implementing Room in your applications recipe. ...