I've added the last two fields to this table: ```...
# room
r
I've added the last two fields to this table:
Copy code
@Entity(indices = [Index("vhost", unique = true)])
data class DeviceInfo(
    @PrimaryKey(autoGenerate = true)
    val id: Long,
    val bluetoothAddress: String,
    val vhost: String,
    val sharedSecret: String,
    @ColumnInfo(defaultValue = "false")
    val canSetWifi: Boolean = false,
    @ColumnInfo(defaultValue = "false")
    val isMagenta: Boolean = false,
    @ColumnInfo(defaultValue = "false")
    val canHaveSIM: Boolean = false,
    @ColumnInfo(defaultValue = "false")
    val canReboot: Boolean = false,
)
But now I'm getting
Copy code
java.lang.IllegalStateException: Migration didn't properly handle: DeviceInfo(me.getreach.familyapp.domain.model.DeviceInfo).
Expected:
  TableInfo{name='DeviceInfo', columns={vhost=Column{name='vhost', type='TEXT', affinity='2', notNull=true, primaryKeyPosition=0, defaultValue='undefined'}, canReboot=Column{name='canReboot', type='INTEGER', affinity='3', notNull=true, primaryKeyPosition=0, defaultValue='false'}, bluetoothAddress=Column{name='bluetoothAddress', type='TEXT', affinity='2', notNull=true, primaryKeyPosition=0, defaultValue='undefined'}, canHaveSIM=Column{name='canHaveSIM', type='INTEGER', affinity='3', notNull=true, primaryKeyPosition=0, defaultValue='false'}, isMagenta=Column{name='isMagenta', type='INTEGER', affinity='3', notNull=true, primaryKeyPosition=0, defaultValue='false'}, canSetWifi=Column{name='canSetWifi', type='INTEGER', affinity='3', notNull=true, primaryKeyPosition=0, defaultValue='false'}, id=Column{name='id', type='INTEGER', affinity='3', notNull=true, primaryKeyPosition=1, defaultValue='undefined'}, sharedSecret=Column{name='sharedSecret', type='TEXT', affinity='2', notNull=true, primaryKeyPosition=0, defaultValue='undefined'}}, foreignKeys=[], indices=[Index{name='index_DeviceInfo_vhost', unique=true, columns=[vhost], orders=[ASC]'}]}
Found:
  TableInfo{name='DeviceInfo', columns={id=Column{name='id', type='INTEGER', affinity='3', notNull=true, primaryKeyPosition=1, defaultValue='undefined'}, bluetoothAddress=Column{name='bluetoothAddress', type='TEXT', affinity='2', notNull=true, primaryKeyPosition=0, defaultValue='undefined'}, vhost=Column{name='vhost', type='TEXT', affinity='2', notNull=true, primaryKeyPosition=0, defaultValue='undefined'}, sharedSecret=Column{name='sharedSecret', type='TEXT', affinity='2', notNull=true, primaryKeyPosition=0, defaultValue='undefined'}, canSetWifi=Column{name='canSetWifi', type='INTEGER', affinity='3', notNull=true, primaryKeyPosition=0, defaultValue='false'}, isMagenta=Column{name='isMagenta', type='INTEGER', affinity='3', notNull=true, primaryKeyPosition=0, defaultValue='false'}, canReboot=Column{name='canReboot', type='INTEGER', affinity='3', notNull=true, primaryKeyPosition=0, defaultValue='0'}, canHaveSIM=Column{name='canHaveSIM', type='INTEGER', affinity='3', notNull=true, primaryKeyPosition=0, defaultValue='0'}}, foreignKeys=[], indices=[Index{name='index_DeviceInfo_vhost', unique=true, columns=[vhost], orders=[ASC]'}]}
With either manual or automigration.
Copy code
val MIGRATION_2_3: Migration = object : Migration(2, 3) {
    override fun migrate(db: SupportSQLiteDatabase) {
        db.execSQL("ALTER TABLE DeviceInfo ADD COLUMN canReboot INTEGER NOT NULL DEFAULT 0")
        db.execSQL("ALTER TABLE DeviceInfo ADD COLUMN canHaveSIM INTEGER NOT NULL DEFAULT 0")
    }
}