Order the steps
Order the steps for adding a pinned column safely.
- Write a MigrationTestHelper test from 3 to 4
- Build to export the new schema JSON and commit it
- Add
val pinned: Boolean = falsewith@ColumnInfo(defaultValue = "0") - Ship
- Bump
versionfrom 3 to 4 and addAutoMigration(from = 3, to = 4)
Choose an answer, then open Show answer below to check it.
Show answer
Answer: C E B A D
- Add
val pinned: Boolean = falsewith@ColumnInfo(defaultValue = "0")A default makes existing rows valid. - Bump
versionfrom 3 to 4 and addAutoMigration(from = 3, to = 4)Room generates the ALTER TABLE. - Build to export the new schema JSON and commit it Auto-migrations and tests read these files.
- Write a MigrationTestHelper test from 3 to 4 Proves real old data survives.
- Ship Only after the migration test passes.