Skip to content

Releases: agrosner/DBFlow

5.0.0-alpha2

13 Mar 15:20
Compare
Choose a tag to compare
5.0.0-alpha2 Pre-release
Pre-release

Many updates!

  1. NEW livedata artifact (consider it experimental). Call .toLiveData on your wrapper queries when included in the project.
  2. Docs have been revamped, lots of fixes and improvements. Removed all java examples in favor of Kotlin usage
  3. Gradle files now use kotlin
  4. Respect order of Primary Key definition in insert statement
  5. Optimize more code generation
  6. RX support is bumped to RX3
  7. Breaking: Index wrapper enable and disable have been replaced with their SQL accurate counterparts createIfNotExists and drop.
  8. New: DBFLow configure DSL
FlowManager.init(context) { 
  // this is FlowConfig.Builder
  database<AppDatabase> {
    // this is DatabaseConfig.Builder
    table<MyTable> {
      // this is TableConfig.Builder
    }
  }
  // other module dbs
  databaseHolder<MyGeneratedDatabaseHolder>()
}
  1. SQL: adds random orderby method
  2. Migrations: support default values in ALTER table statement
  3. Migrations: Restore pre 5.0.0-alpha1 migration order where they run after table creation in upgrade of DB.
  4. Foreign Key Constraints: fix issue where foreign key constraint support not always enabled or done properly. Now we perform it in onConfigure of the DB.
  5. NEW: FTS4 and FTS3 support.
  6. Breaking: Require DatabaseWrapper in any db operation, removing model extension methods that are parameterless in most places. to grab DB, use database<MyDatabase> { db -> or val db = database<MyDatabase>()
  7. Breaking: Breaking change: String "?" no longer are unescaped and treated as blank INSERT value args. Use Property.WILDCARD instead.
  8. Model queries that do not run in a transaction now will log as warnings to encourage you to place them in transactions.
  9. NEW: TableObserver provides a way to observe table changes in an efficient way for observable queries.
  10. NEW: match operator for queries
  11. NEW: tables can be represented without actually being created in the DB. use createWithDatabase in the @Table or @ModelView annotations.
  12. Breaking: IMultiKeyCacheConverter -> MultiKeyCacheConverter
  13. NEW: create TEMP tables support using @Table(temporary = true)
  14. Breaking: async queries from RX asFlowable or others, instead of passing DatabaseWrapper and ModelQueriable like:
.asFlowable { d, modelQueriable -> modelQueriable.queryList(d) }

Now its the receiver parameter of the function:

.asFlowable { db -> queryList(db) }
  1. OneToMany: fix issue where cache and one to many would not work when using the all operators.
  2. FlowQueryList/FlowCursorList: allow passing own Handler to be used rather than the thread its created on.
  3. Breaking: its an error to have multiple converters on the same model type. Error message describes how to fix.
  • allow overwriting built-ins without error
  • better error messaging in general with less noise
  1. BaseProviderModel: fix potential leaking cursor when no results found.
  2. SQLCipher: Latest version is now 4.4.2, Write ahead logging support!
  3. Breaking: prepackaged dbs now can run migrations to get to current version when db version is 0 but we set our db version to something higher. This reduces errors by allowing you to keep an older version of DB as prepackaged but will run through migrations to get to current app version's DB.

Also many bug fixes!
https://github.com/agrosner/DBFlow/milestone/51?closed=1

5.0.0-alpha1

21 Oct 02:29
7176c0d
Compare
Choose a tag to compare
5.0.0-alpha1 Pre-release
Pre-release
  1. Rename package name for project to com.dbflow5. Some significant package reorganization that makes much more sense going forward.
  2. Project is back under my account! To include, please replace uses of "com.github.raizlabs.dbflow:" to "com.github.agrosner.dbflow:" in project dependencies.
  3. Added new paging, coroutines, contentprovider (splits out use into separate module). Expect a livedata module in next couple releases. Removed RXJava 1 support.
  4. Library is now 100% KOTLIN! (except generated java code, which can't quite yet be Kotlin). All kotlin-extensions modules have rolled into their java counterpart as a single Kotlin unit.
  5. Simplifications in API for Transactions to eliminate redundancies. Also, now Transaction require a type parameter R which is return value. They now return a value, and have a completion() callback. All interfaces have rolled into Kotlin Typealias to methods.
  6. All sqlite query language infix (LINQ-style) methods rolled into the query language!
  7. Attempted to keep java compatibility and nice API. If anything is missing, please file a bug.
  8. save() now use a insert or replace statement rather than a load of the model from the db and then inserting / saving based on that, resulting in significant performance increase.
  9. no more ContentValues used at all in any CRUD operations under the hood, and by default these don't get generated: bindToInsertValues, bindToContentValues. if you need them, set @Table(generateContentValues = true).
  10. Breaking Change: By default @Table(allFields = true), meaning you dont have to explicitly mark each property as part of DB. Previously you had to use @Column everywhere.

4.2.4

28 Dec 17:08
0e06ea8
Compare
Choose a tag to compare
  1. dropTrigger from SqlUtils takes in a DatabaseWrapper.
  2. Fix broken annotation processor code output tests. #1437
  3. Fix issues where DatabaseStatement in library in wrapper statements were not closed properly. #1497
  4. Fix issue where single reference (non table object) used wrong name for property in the primary condition clause, causing compile issue. #1504

4.2.3

20 Dec 13:46
eb5ed84
Compare
Choose a tag to compare
  1. update Issue template
  2. fix pom file generation on jitpack #1487
  3. fix issue where save(DatabaseWrapper) would leave open insert or update statment. #1496
  4. Allow (but still warn) about autoincrementing ids being null. if null, they are treated as if they are 0 meaning that they will get inserted rather than updated in the DB during a save operation. #1490
  5. Update warning on wrong type passed in operator class for value #1488

4.2.2

18 Dec 23:09
d4bd71b
Compare
Choose a tag to compare

Fix critical issue where TypeConverter always appear as SQLiteType.TEXT in the DB even if its type did not match up.

Adds a test to ensure it stays true.

#1481

4.2.1

17 Dec 16:18
6eaee99
Compare
Choose a tag to compare

Add FlowQueryList.Builder.contentAuthority() parameter to go in conjunction with 4.2.0 changes.

4.2.0

17 Dec 15:59
966a9ad
Compare
Choose a tag to compare

Support for Android O Content Providers.
Simply add this line to your AndroidManifest.xml:

<provider
            android:name="com.raizlabs.android.dbflow.runtime.StubContentProvider"
            android:authorities="com.dbflow.authority"/>

Which will allow normal content observing to continue.
It is highly recommended to supply your own authority: use your own package name. so for com.grosner.example app I would add:

<provider
            android:name="com.raizlabs.android.dbflow.runtime.StubContentProvider"
            android:authorities="com.grosner.example"/>
FlowManager.init(FlowConfig.Builder(context)
            .addDatabaseConfig(DatabaseConfig.Builder(MyDatabase.class)
                .modelNotifier(new ContentResolverNotifier("com.grosner.example"))
                .build()).build());

4.1.2

21 Oct 17:53
Compare
Choose a tag to compare
  1. Autoincrement model saver does not call saveForeignKeys() #1454
  2. Ability to reopen DB without deleting #1449
  3. AutoIncrementModelSaver causes IllegalArgumentException since it uses wrong insert statement #1447
  4. Disallow nullable autoincrementing fields. (kotlin nullable (?) and @nullable annotations)
  5. Can close all DBs at runtime. #1418
  6. fix support for byte[], class was incorrectly treated as invalid array type. #1463
  7. Compiled with Kotlin 1.1.51, 26.0.2 of Android build-tools, and 3.0.0-rc2 of Android Gradle plugin.

4.1.1

31 Aug 22:49
Compare
Choose a tag to compare
  1. Fix issue with ByteArray and TypeConverter #1385
  2. Fix issue where processor used implementation. switched back to compile.

4.1.0

27 Aug 23:13
Compare
Choose a tag to compare
  1. @ModelView are now created after migrations are run so latest DB data is respected.
  2. New annotation @ColumnMap! It enables embedding other object's exposed properties into the current table as @Column so that object hierarchy is respected without excessive DB complication.
class Location(var latitude: Double = 0.0, var longitude: Double = 0.0)

@Table(database = TestDatabase::class)
class Position(@PrimaryKey var id: Int = 0, @ColumnMap var location: Location? = null)

creates a table with the following columns:

  public static final Property<Integer> id = new Property<Integer>(Position.class, "id");
  public static final Property<Double> latitude = new Property<Double>(Position.class, "latitude");
  public static final Property<Double> longitude = new Property<Double>(Position.class, "longitude");
  1. @database(name = , extension = ) are deprecated. Specify the name now in the DatabaseConfig.databaseName() when FlowManager is initialized. This means that DBFlow supports dynamic database names and instances.
FlowManager.init(FlowConfig.builder()
    .addDatabaseConfig(DatabaseConfig.builder(AppDatabase.class)
      .databaseName("AppDatabase")
      .databaseExtension(".txt")
      .build())
    .build())

To dynamically swap database out, replace the FlowConfig:

FlowManager.getDatabase(AppDatabase.class)
  .reset(DatabaseConfig.builder(AppDatabase.class)
    .databaseName("AppDatabase-2")
    .build())

Note that this will overwrite all existing database properties for a database. Any TableConfig properties missing will get ignored. Also it will delete existing db and reopen with new instance specified.

  1. @database(inMemory = ) is deprecated. Use the new builder method:
FlowManager.init(FlowConfig.builder()
    .addDatabaseConfig(DatabaseConfig.inMemoryBuilder(AppDatabase.class)
      .databaseName("AppDatabase")
      .build())
    .build())
  1. Support javax.annotation.Generated if it's on the classpath.
  2. @database(generatedClassSeparator = ) is now deprecated. It will be standardized to the default _ in a future breaking release.
  3. @OneToMany now auto-detect visibility of the reference field so isVariablePrivate() is deprecated.
  4. Can specify @ForeignKeyReference(notNull = @NotNull()) annotation for individual references. Required to specify all references on a @ForeignKey if you need to specify for one.
  5. Some better error messaging in the annotation processor so its easier to find solutions to common issues.
  6. Rename count() (deprecated) to longValue() so its more clear exactly what is happening.
  7. fix #1401 which enables custom TypeConverters to carry into an as() alias of a Property.
  8. Add new TransactionWrapper which allows grouping of ITransaction into one to get executed at same point in db time.
  9. Lib now compiles with SDK 26 with latest build tools including api/implementation of 3.0.0+ gradle plugin.
  10. RXJava2 is now updated to 2.1.3
  11. Update some methods of dbflow-kotlin-extensions to accept nullable values for objects where it makes sense. See commit
  12. Automatic creation of tables can be turned off on a table-by-table basis with createWithDatabase(). Useful for preserving scrapped table in previous migrations.
  13. Using Kotlin we can drastically reduce the @OneToMany code implementation:
    @OneToMany(methods = {OneToMany.Method.ALL}, variableName = "ants")
    public List<Ant> getMyAnts() {
        if (ants == null || ants.isEmpty()) {
            ants = SQLite.select()
                .from(Ant.class)
                .where(Ant_Table.queen_id.eq(id))
                .queryList();
        }
        return ants;
    }

to:

@get:OneToMany(methods = arrayOf(OneToMany.Method.ALL))
var ants by oneToMany { select from Ant::class where (Ant_Table.queen_id.eq(id)) }