Version 2.4.0
- Auto Migrations API for automatically generating migrations when schemas are exported using @Database#autoMigrations property
- @AutoMigration annotation to declare specification classes for table and column renames or deletes in auto migrations
- @ProvidedAutoMigrationSpec API for declaring that an AutoMigrationSpec will be provided at runtime via RoomDatabase.Builder#addAutoMigrationSpec()
- androidx.room:room-paging library providing native Paging 3.0 support for Room queries returning androidx.paging.PagingSource
- Multimap return types support in @Dao methods for JOIN statements including Map, SparseArray, LongSparseArray, and Guava's ImmutableMap, ImmutableSetMultimap and ImmutableListMultimap
- MigrationTestHelper now supports auto migrations with a new constructor API that receives the database class under test
From Room
Auto Migrations: Room now offers an API for automatically generating migrations as long as schemas are exported. To let Room know that it should generate an auto-migration a new property @Database#autoMigrations can be used to declare the versions to auto-migrate from and to. When Room needs additional information regarding tables and column renames or deletes, then the @AutoMigration annotation can declare a specification class containing such inputs. See the @AutoMigration documentation for more details. Dependency Injection in Auto Migrations: @ProvidedAutoMigrationSpec is a new API for declaring that an AutoMigrationSpec will be provided at runtime via RoomDatabase.Builder#addAutoMigrationSpec(). This allows for a dependency injection framework to provide such specs when they need complex dependencies. Migration Test Helper Support for Auto Migrations: Room's MigrationTestHelper was updated to support auto migrations by providing a new constructor API that receives the database class under test. This allows the helper to automatically add auto migrations the same way during runMigrationsAndValidate. Room-Paging Support: androidx.room:room-paging is released, providing native Paging 3.0 support for Room queries returning androidx.paging.PagingSource. Relational Query Methods: Room now supports multimap return types @Dao methods, useful for JOIN statements. The supported types of multimaps are Map, SparseArray, LongSparseArray, along with Guava's ImmutableMap, ImmutableSetMultimap and ImmutableListMultimap.