Android Room migration didn't properly handle (wrong columns order)
Expected:
coffees_volume=Column{name='coffees_volume', type='INTEGER', affinity='3', notNull=true, primaryKeyPosition=0}
Found:
coffees_volume=Column{name='coffees_volume', type='INTEGER', affinity='3', notNull=false, primaryKeyPosition=0}
The problem is in your notNull
attribute.
Replace your model with following code:
@Entity(tableName = "coffee_productivity", indices = [Index(value = "date", unique = true)])
data class CoffeeProductivityData(
@PrimaryKey(autoGenerate = true) var id: Long?,
@ColumnInfo(name = "date") var date: String,
@ColumnInfo(name = "productivity") var productivity: Int,
@ColumnInfo(name = "number_of_coffees") var numberOfCoffees: Int,
@ColumnInfo(name = "coffees_volume") var coffeesVolume: Int? = 0)
{
constructor() : this(null, "00/00/0000", 0, 0, 0)
}