Note: Room Auto Migration is in Beta - 2.4.0-beta02
I've deleted two columns in two different tables. And I tried repeat the @DeleteColumn
annotation, like so
@DeleteColumn(tableName = "User", columnName = "phone")
@DeleteColumn(tableName = "Product", columnName = "description")
@DeleteTable(tableName = "Category")
class TestRoomAutoMigration: AutoMigrationSpec { }
but I get this error
Repeatable annotations with non-SOURCE retention are not yet supported
Questions
Kotlin has yet to add full support for repeatable annotations with the same syntax as Java. So we'll have to use the container annotation, like this:
@DeleteColumn.Entries(
DeleteColumn(tableName = "User", columnName = "phone"),
DeleteColumn(tableName = "Product", columnName = "description"),
)
@DeleteTable(tableName = "Category")
class TestRoomAutoMigration: AutoMigrationSpec { }
This works for renaming columns too.
This was first answered on the Google issue tracker - link
Kotlin is now supports repeatable annotations in version 1.6
org.jetbrains.kotlin:kotlin-gradle-plugin:1.6.0
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With