Status Update
Comments
da...@google.com <da...@google.com> #2
So, the view is something we added recently. It appears that
- removing the view entirely, the destructive migration works. But it doesn't actually remove the view.
- adding the view back in, the destructive migration fails with the same message.
It appears that the destructive migration is not dropping the view, but it does try to create it again, which is what blows up.
I was able to work around this by adding a RoomCallback
and overriding the onDestructiveMigration callback to manually delete the view:
override fun onDestructiveMigration(connection: SQLiteConnection) {
super.onDestructiveMigration(connection)
connection.execSQL("DROP VIEW IF EXISTS calendar_items_view")
}
This is a pretty big potential footgun for anyone using views with destructive migrations!
da...@google.com <da...@google.com> #3
This sounds like a bug, with destructive migrations turned ON, views should also be recreated and it seems they are not being dropped before being created again leading to the 'already exists' issue.
da...@google.com <da...@google.com> #4
Project: platform/frameworks/support
Branch: androidx-main
Author: Daniel Santiago Rivera <
Link:
Drop views during destructive migrations.
Expand for full commit details
Drop views during destructive migrations.
When 'allowDestructiveMigrationForAllTables' is turned ON (default in KMP) it should also drop all views so they can be recreated, this follows the same behaviour as when 'allowDestructiveMigrationForAllTables' is OFF and the RoomDatabase defined views are dropped.
Bug: 381518941
Test: MigrationTest
Change-Id: Iaf27b30b859b3a21f71d252e5c223dfd28365da0
Files:
- M
room/integration-tests/testapp/src/androidTest/java/androidx/room/integration/testapp/migration/MigrationTest.java
- M
room/room-runtime/src/androidMain/kotlin/androidx/room/RoomOpenHelper.android.kt
- M
room/room-runtime/src/commonMain/kotlin/androidx/room/RoomConnectionManager.kt
Hash: 0a3e83009a1f514c7d43870110b63eebb0371efc
Date: Wed Dec 04 10:53:59 2024
ap...@google.com <ap...@google.com> #5
The following release(s) address this bug.It is possible this bug has only been partially addressed:
androidx.room:room-runtime:2.7.0-alpha12
androidx.room:room-runtime-android:2.7.0-alpha12
androidx.room:room-runtime-iosarm64:2.7.0-alpha12
androidx.room:room-runtime-iossimulatorarm64:2.7.0-alpha12
androidx.room:room-runtime-iosx64:2.7.0-alpha12
androidx.room:room-runtime-jvm:2.7.0-alpha12
androidx.room:room-runtime-linuxarm64:2.7.0-alpha12
androidx.room:room-runtime-linuxx64:2.7.0-alpha12
androidx.room:room-runtime-macosarm64:2.7.0-alpha12
androidx.room:room-runtime-macosx64:2.7.0-alpha12
ap...@google.com <ap...@google.com> #6
Project: platform/frameworks/support
Branch: androidx-main
Author: Daniel Santiago Rivera <
Link:
Migrate androidx.sqlite to use KMP AutoCloseable
Expand for full commit details
Migrate androidx.sqlite to use KMP AutoCloseable
AutoCloseable common was added in Kotlin 2.0
Bug: 315461431
Test: Existing
Relnote: Migrate androidx.sqlite.use to Kotlin's AutoCloseable's use in the stdlib.
Change-Id: I470f02620d43bbe641c58e3fc3637119e8c44532
Files:
- M
room/integration-tests/multiplatformtestapp/src/commonTest/kotlin/androidx/room/integration/multiplatformtestapp/test/BaseAutoMigrationTest.kt
- M
room/integration-tests/multiplatformtestapp/src/commonTest/kotlin/androidx/room/integration/multiplatformtestapp/test/BaseMigrationTest.kt
- M
room/room-paging/src/androidInstrumentedTest/kotlin/androidx/room/paging/LimitOffsetPagingSourceTest.kt
- M
room/room-paging/src/androidMain/kotlin/androidx/room/paging/LimitOffsetPagingSource.android.kt
- M
room/room-runtime/src/androidMain/kotlin/androidx/room/coroutines/AndroidSQLiteDriverConnectionPool.android.kt
- M
room/room-runtime/src/androidMain/kotlin/androidx/room/driver/SupportSQLiteConnectionPool.android.kt
- M
room/room-runtime/src/commonMain/kotlin/androidx/room/EntityDeleteOrUpdateAdapter.kt
- M
room/room-runtime/src/commonMain/kotlin/androidx/room/EntityInsertAdapter.kt
- M
room/room-runtime/src/commonMain/kotlin/androidx/room/InvalidationTracker.kt
- M
room/room-runtime/src/commonMain/kotlin/androidx/room/RoomConnectionManager.kt
- M
room/room-runtime/src/commonMain/kotlin/androidx/room/coroutines/ConnectionPoolImpl.kt
- M
room/room-runtime/src/commonMain/kotlin/androidx/room/util/ConnectionUtil.kt
- M
room/room-runtime/src/commonMain/kotlin/androidx/room/util/DBUtil.kt
- M
room/room-runtime/src/commonMain/kotlin/androidx/room/util/SchemaInfoUtil.kt
- M
room/room-runtime/src/commonTest/kotlin/androidx/room/coroutines/BaseConnectionPoolTest.kt
- M
room/room-testing/src/commonMain/kotlin/androidx/room/testing/MigrationTestHelper.kt
- M
sqlite/integration-tests/driver-conformance-test/build.gradle
- M
sqlite/integration-tests/driver-conformance-test/src/commonTest/kotlin/androidx/sqlite/driver/test/BaseBundledConformanceTest.kt
- M
sqlite/integration-tests/driver-conformance-test/src/commonTest/kotlin/androidx/sqlite/driver/test/BaseConformanceTest.kt
- M
sqlite/sqlite/api/current.txt
- M
sqlite/sqlite/api/restricted_current.txt
- M
sqlite/sqlite/bcv/native/current.txt
- M
sqlite/sqlite/src/commonMain/kotlin/androidx/sqlite/SQLite.kt
- M
sqlite/sqlite/src/commonMain/kotlin/androidx/sqlite/SQLiteConnection.kt
- M
sqlite/sqlite/src/commonMain/kotlin/androidx/sqlite/SQLiteStatement.kt
Hash: 62cf305b742fc901c10da7d435f77d2a38f9d67e
Date: Mon Dec 16 11:39:49 2024
da...@google.com <da...@google.com>
na...@google.com <na...@google.com> #7
The following release(s) address this bug.It is possible this bug has only been partially addressed:
androidx.room:room-common:2.7.0-alpha13
androidx.room:room-common-iosarm64:2.7.0-alpha13
androidx.room:room-common-iossimulatorarm64:2.7.0-alpha13
androidx.room:room-common-iosx64:2.7.0-alpha13
androidx.room:room-common-jvm:2.7.0-alpha13
androidx.room:room-common-linuxarm64:2.7.0-alpha13
androidx.room:room-common-linuxx64:2.7.0-alpha13
androidx.room:room-common-macosarm64:2.7.0-alpha13
androidx.room:room-common-macosx64:2.7.0-alpha13
androidx.room:room-compiler:2.7.0-alpha13
androidx.room:room-compiler-processing:2.7.0-alpha13
androidx.room:room-ktx:2.7.0-alpha13
androidx.room:room-migration:2.7.0-alpha13
androidx.room:room-migration-iosarm64:2.7.0-alpha13
androidx.room:room-migration-iossimulatorarm64:2.7.0-alpha13
androidx.room:room-migration-iosx64:2.7.0-alpha13
androidx.room:room-migration-jvm:2.7.0-alpha13
androidx.room:room-migration-linuxarm64:2.7.0-alpha13
androidx.room:room-migration-linuxx64:2.7.0-alpha13
androidx.room:room-migration-macosarm64:2.7.0-alpha13
androidx.room:room-migration-macosx64:2.7.0-alpha13
androidx.room:room-paging:2.7.0-alpha13
androidx.room:room-paging-android:2.7.0-alpha13
androidx.room:room-paging-guava:2.7.0-alpha13
androidx.room:room-paging-iosarm64:2.7.0-alpha13
androidx.room:room-paging-iossimulatorarm64:2.7.0-alpha13
androidx.room:room-paging-iosx64:2.7.0-alpha13
androidx.room:room-paging-jvm:2.7.0-alpha13
androidx.room:room-paging-linuxarm64:2.7.0-alpha13
androidx.room:room-paging-linuxx64:2.7.0-alpha13
androidx.room:room-paging-macosarm64:2.7.0-alpha13
androidx.room:room-paging-macosx64:2.7.0-alpha13
androidx.room:room-paging-rxjava2:2.7.0-alpha13
androidx.room:room-paging-rxjava3:2.7.0-alpha13
androidx.room:room-runtime:2.7.0-alpha13
androidx.room:room-runtime-android:2.7.0-alpha13
androidx.room:room-runtime-iosarm64:2.7.0-alpha13
androidx.room:room-runtime-iossimulatorarm64:2.7.0-alpha13
androidx.room:room-runtime-iosx64:2.7.0-alpha13
androidx.room:room-runtime-jvm:2.7.0-alpha13
androidx.room:room-runtime-linuxarm64:2.7.0-alpha13
androidx.room:room-runtime-linuxx64:2.7.0-alpha13
androidx.room:room-runtime-macosarm64:2.7.0-alpha13
androidx.room:room-runtime-macosx64:2.7.0-alpha13
androidx.room:room-rxjava2:2.7.0-alpha13
androidx.room:room-rxjava3:2.7.0-alpha13
androidx.room:room-testing:2.7.0-alpha13
androidx.room:room-testing-android:2.7.0-alpha13
androidx.room:room-testing-iosarm64:2.7.0-alpha13
androidx.room:room-testing-iossimulatorarm64:2.7.0-alpha13
androidx.room:room-testing-iosx64:2.7.0-alpha13
androidx.room:room-testing-jvm:2.7.0-alpha13
androidx.room:room-testing-linuxarm64:2.7.0-alpha13
androidx.room:room-testing-linuxx64:2.7.0-alpha13
androidx.room:room-testing-macosarm64:2.7.0-alpha13
androidx.room:room-testing-macosx64:2.7.0-alpha13
androidx.sqlite:sqlite:2.5.0-alpha13
androidx.sqlite:sqlite-android:2.5.0-alpha13
androidx.sqlite:sqlite-bundled:2.5.0-alpha13
androidx.sqlite:sqlite-bundled-android:2.5.0-alpha13
androidx.sqlite:sqlite-bundled-iosarm64:2.5.0-alpha13
androidx.sqlite:sqlite-bundled-iossimulatorarm64:2.5.0-alpha13
androidx.sqlite:sqlite-bundled-iosx64:2.5.0-alpha13
androidx.sqlite:sqlite-bundled-jvm:2.5.0-alpha13
androidx.sqlite:sqlite-bundled-linuxarm64:2.5.0-alpha13
androidx.sqlite:sqlite-bundled-linuxx64:2.5.0-alpha13
androidx.sqlite:sqlite-bundled-macosarm64:2.5.0-alpha13
androidx.sqlite:sqlite-bundled-macosx64:2.5.0-alpha13
androidx.sqlite:sqlite-framework:2.5.0-alpha13
androidx.sqlite:sqlite-framework-android:2.5.0-alpha13
androidx.sqlite:sqlite-framework-iosarm64:2.5.0-alpha13
androidx.sqlite:sqlite-framework-iossimulatorarm64:2.5.0-alpha13
androidx.sqlite:sqlite-framework-iosx64:2.5.0-alpha13
androidx.sqlite:sqlite-framework-linuxarm64:2.5.0-alpha13
androidx.sqlite:sqlite-framework-linuxx64:2.5.0-alpha13
androidx.sqlite:sqlite-framework-macosarm64:2.5.0-alpha13
androidx.sqlite:sqlite-framework-macosx64:2.5.0-alpha13
androidx.sqlite:sqlite-iosarm64:2.5.0-alpha13
androidx.sqlite:sqlite-iossimulatorarm64:2.5.0-alpha13
androidx.sqlite:sqlite-iosx64:2.5.0-alpha13
androidx.sqlite:sqlite-jvm:2.5.0-alpha13
androidx.sqlite:sqlite-ktx:2.5.0-alpha13
androidx.sqlite:sqlite-linuxarm64:2.5.0-alpha13
androidx.sqlite:sqlite-linuxx64:2.5.0-alpha13
androidx.sqlite:sqlite-macosarm64:2.5.0-alpha13
androidx.sqlite:sqlite-macosx64:2.5.0-alpha13
Description
API checks and Java ecosystem recommends SQLiteConnection and SQLiteStatement to implement Closeable / AutoCloseable but there is no KMP common Closeable interface. Other art work has defined a expect Closeable in commonMain and have actual typealias to Java's interface and implemented utility function in native.
It would be also nice if we can add finalizers to close things and warn about leaks. JVM and Android has finalizer APIs (https://docs.oracle.com/javase/9/docs/api/java/lang/ref/Cleaner.html ) along with the soon-to-be-deprecated https://kotlinlang.org/docs/java-interop.html#finalize ) and in iOS there is https://kotlinlang.org/docs/native-ios-integration.html#deinitializers ). But I don't think there is anything available for native...
finalize()
(deinit
(