Pattern matching in Kotlin is nice and the fact it does not execute the next pattern match is good in 90% of use cases.
In Android, when database is updated, we use J
Another variation of OP's answer:
override fun onUpgrade(db: SQLiteDatabase, oldVersion: Int, newVersion: Int) { when (oldVersion) { newVersion -> return 1 -> TODO("upgrade from v1 to v2") 2 -> TODO("upgrade from v2 to v3") } oldVersion++ onUpgrade(db, oldVersion, newVersion) }