I am trying to migrate from Sqlite to Room but I am getting a migration error, I believe it is due to the fact that I used VARCHAR() (I followed a guide, definitely wish I would have just used TEXT, but can't fix that now).
Here is my entity:
@Entity(tableName = "conversation")
class Conversation(@PrimaryKey
@ColumnInfo(name = "key") val key: Int,
@ColumnInfo(name = "message_id") val messageId: String?,
@ColumnInfo(name = "thread_id") val threadId: String?,
@ColumnInfo(name = "address") val address: String?,
@ColumnInfo(name = "group_address") val groupAddress: String?,
@ColumnInfo(name = "name") val name: String?,
@ColumnInfo(name = "group_name") val groupName: String?,
@ColumnInfo(name = "body") val body: String?)
Here is the error that I am getting:
Expected:
TableInfo{name='conversation', columns={date=Column{name='date', type='INTEGER', notNull=false, primaryKeyPosition=0}, address=Column{name='address', type='TEXT', notNull=false, primaryKeyPosition=0}.....
Found:
TableInfo{name='conversation', columns={date=Column{name='date', type='INTEGER', notNull=false, primaryKeyPosition=0}, address=Column{name='address', type='VARCHAR(14)', notNull=false, primaryKeyPosition=0}....
And it is just a whole bunch of that, and I am not really sure of how to convert VARCHAR to text or anything like that
Edit: Migration Method
override fun migrate(database: SupportSQLiteDatabase) {
database.execSQL(TexpertDatabase.CONVO_CREATE) //Creates table named conversation_temp with preferred schema
database.execSQL("INSERT INTO conversation_temp SELECT ${TexpertDatabase.allCols} FROM conversation")
database.execSQL("DROP TABLE conversation")
database.execSQL("ALTER TABLE conversation_temp RENAME TO conversation")
}