Adding a Suspect to the Model Layer
Next, open Crime.kt and give Crime a property that will hold the name of a suspect.
Listing 15.3 Adding a suspect property (
@Entity data class Crime(@PrimaryKey val id: UUID = UUID.randomUUID(), var title: String = "", var date: Date = Date(), var isSolved: Boolean = false, var suspect: String = "")
Now you need to add an additional property to your crime database. This requires incrementing the version of your CrimeDatabase class, as well as telling Room how to migrate your database between the versions.
To tell Room how to change your database from one version to another, you provide a Migration. Open CrimeDatabase.kt, add a migration, and increment the version.