Florina, thank you for the more detailed breakdown elaborating on the current migration documentation.

I discovered a simple solution to handle the renaming of a column migration, however it is only supported in SQLite 3.25. According to the SQLite version history for Android the latest documented support is for API Level 27, which is for SQLite 3.19. Is there a rough estimate of when API Level 28 will be listed under the version history with the latest support level for SQLite?

I attempted the complex schema change unsuccessfully in order to modify the name of one attribute / column. Here is a basic version of what I attempted.

val MIGRATION_1_2: Migration = object : Migration(1, 2) {
override fun migrate(database: SupportSQLiteDatabase) {
// Create the new table
database.execSQL("CREATE TABLE content_new (id TEXT, contentType INTEGER, timestamp INTEGER, viewCount REAL, PRIMARY KEY(id))")
// Copy the data
database.execSQL("INSERT INTO content_new (id, contentType, timestamp, viewCount) SELECT id, contentType, timestamp viewCount FROM content")
// Remove the old table
database.execSQL("DROP TABLE content")
// Change the table name to the correct one
database.execSQL("ALTER TABLE content_new RENAME TO content")
}
}

Runtime error

java.lang.IllegalStateException: Migration didn't properly handle content(app.coinverse.content.models.Content).

I’ve inspected the Expected and Found tables the log prints and they appear to be identical. I’ve created a Stackoverflow post for this issue.

Creator of Coinverse - The 1st Crypto News Audiocast App @ bit.ly/play-coin

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store