5.0 Migration Guide
This lists out the major changes since < 5.0
Last updated
Was this helpful?
This lists out the major changes since < 5.0
Last updated
Was this helpful?
Major Changes
Package name is now com.dbflow5
, which enables bundling multiple versions in the same repo.
Note: Using multiple versions of DBFlow on the same DB is not recommended, as it can lead to inconsistent usage on the database in respect to transaction queuing, migrations, or synchronization.
Library is now 100% Kotlin, except generated code. KSP (Kotlin Source Processing) is promising, but will require major updates to support it directly. This means that any -kotlinextensions
artifacts are now rolled into the library.
Library now adds support for incremental annotation processing. Please report any issues!
New artifacts: paging
(architecture components Paging), coroutines
, contentprovider
, (splits out ContentProvider
usage out of main library), livedata
, reactive-streams
(RXJava3).
RXJava
1 and 2 support is dropped given, is now in maintenance mode. You simply need to copy paste the reactive-streams
files you need and then replace the package names back to their RXJava2 equivalent. RXJava 1 is not quite equivalent and not supported.
save()
methods on the ModelAdapter
classes now use a more efficient INSERT OR REPLACE
method, rather than check if exists
manually from the DB before inserting or replacing.
@Database
classes must now be an abstract class that extends DBFlowDatabase
(or related subclass)
Removed deprecated @Database
annotation fields including name
, databaseExtension
, and inMemory
. Use the DatabaseConfig.Builder
object when initializing DBFlow (see for some examples).
The implicit DatabaseWrapper
that was used in model operations is now required explicit.
ModelAdapter.bindToContentValues
and corresponding ContentValues
generated code is no longer enabled by default. If you need ContentValues
generation, set @Table(generateContentValues = true)
.
Note: For @ContentProvider
object, your db must now extend ContentProviderDatabase
to supply ContentValues
methods on the database. This lives in a separate artifact named contentprovider
.
Explicitly marking every field in a @Table
with @Column
is no longer the default. By default, any visible field in the model class are referenced. To enable the old behavior use @Table(allFields = false)
Adds @Fts3
and @Fts4
annotations. See SQLite docs on Added corresponding snippet
and offsets
method support.