Android Room Migration: New column with data derived from existing Enum data
If we have Enum data in our table and for some reason, we need to create a new column with values based on the data from the enum we need to migrate it using the manual room migration.
For example,
Current data model
Updated data model
We will see how it is done.
Step 1
Create the new column with a default value.
Step 2
Update the column data
We can use CASE
in SQLite to update the data based on the different enum values.
Please comment with your valuable feedback. It would help me to improvise.
Kindly 👏👏👏 if this was useful.
Please follow if you would like to see more content related to Android Jetpack Compose.