Releases: agrosner/DBFlow
4.0.0-beta3
- Rewrote most tests in full Kotlin
- Some bug fixes
- Update to 1.5.0-2 of Kotlin
- Update to compile with API 25 + 2.2.3 of Gradle plugin
- Simplified
ForeignKeyReference
annotation when specifying it in the@ForeignKey
. Removed :columnType()
,referencedFieldIsPrivate()
,
referencedFieldIsPackagePrivate()
,referencedGetterName()
, andreferencedSetterName()
since we already were grabbing the referenced definition in the processor. This will eliminate need for those fields and should make simple headaches go away! - If DB gets closed, we reopen it next time we use it in the lib.
- Add Selection args to
StringQuery
- Fixed an issue where multiple modules may have been broken.
4.0.0-beta2
- Upgrade to API 25 (7.1.1)
@Column
withTypeConverter
now properly convert specifiedModel
types in SQLite queries via the generatedTypeConvertedProperty
class! Also you can reverse the query to specify the Database-typed query in a SQLite query:
Coordinate coord = ...;
SQLite.select().from(MyTable.class).
.where(MyTable_Table.coordinate.eq(coord))
.querySingle();
or
Latitude lat = ...;
SQLite.select().from(MyTable.class).
.where(MyTable_Table.coordinate.invertProperty().eq("40.707720, -74.014842"))
.querySingle();
- Add
BigDecimalConverter
as default converted included in lib. - Fix issue with private field access in a
@ForeignKey
reference, due to new processor code. - More bug fixes.
- Remove type param from
BaseModelView
, no longer necessary or needed. - Fixes issue where
Enum
were not properly converted.
4.0.0-beta1
In 4.0, DBFlow has greatly improved its internals and flexibility in this release. We have removed the Model
restriction, rewritten the annotation processor completely in Kotlin, and more awesome improvements.
Major Changes In this release
PrimaryKey
can haveTypeConverters
, be table-based objects, and all kinds of objects. No real restrictions.ForeignKey
have been revamped to allowstubbedRelationship
. This replacesForeignKeyContainer
.Model
interface now includesload()
to enabled reloading very easily when fields change.- All
ModelContainer
implementation + support has been removed. A few reasons pushed the removal, including implementation. Since removing support, the annotation processor is cleaner, easier to maintain, and more streamlined. Also the support for it was not up to par, and by removing it, we can focus on improving the quality of the other features. - The annotation processor has been rewritten in Kotlin! By doing so, we reduced the code by ~13%.
- Removed the
Model
restriction on tables. If you leave out extendingBaseModel
, you must interact with theModelAdapter
. - We generate ~45% less code than 3.0. Combined the
_Table
+_Adapter
into the singular_Table
class, which contains bothProperty
+ all of the regularModelAdapter
methods. To ease the transition to 4.0, it is named_Table
but extendsModelAdapter
. So most use cases / interactions will not break.
3.1.1
Fix issue where project did not build on jitpack.io due to javadoc issues.
Transaction
Handler
only initialized when used, not when class first accessed to prevent unnecessary Handler
thread from starting.
Also Transaction
now have a newBuilder()
method to allow easy copying of existing Transaction
.
3.1.0
- Bug fixes
- Fixes an issue where prepackaged databases were not copied over on initialization of DB. #867. Affects all versions post-3.0.0-beta6.
- New builder syntax for
FlowQueryList
+FlowCursorList
. Deprecated a lot of their old methods. Also created aFlowCursorIterator
so that iteration inFlowCursorList
+FlowQueryList
becomes way more efficient. Instead of loading the full list when iterating, it iterates and converts objects as you need them:
for (TestModel model : cursorList) {
}
- Can add
primaryKeyConflict
to@Table
to optionally specify a conflict for a Primary key that gets appended to the creation query. - NEW Kotlin SQLite LINQ-Style Syntax and improvements to the Kotlin Support. In
dbflow-kotlinextensions
you can now write queries in Kotlin as:
var results = (select
from Result::class
where (column eq 6)
and (column2 `in`("5", "6", "9"))
groupBy column).list
// can call .result for single result
// .hasData if it has results
// .statement for a compiled statement
Some new syntactic sugar that makes queries even more functional:
model.async save {
// completed, now do something with model
}
Retrievals:
(select
from Result::class
where (column eq 6))
.async result { transaction, model ->
// do something here
updateUI(model)
}
for Lists:
// easy async list query
(select
from Result::class
where (column eq 6))
.async list { transaction, list ->
// do something here
updateUI(list)
}
3.0.1
- Fixes issue where
AsyncModel
operations did not actually operate on its associatedModel
. - Fix code gen for overridden Update, Insert, delete ops where passing in
DatabaseWrapper
did not honor@OneToMany
annotation. - Fix issue where
ListModelSaver
ignores caching rules.
3.0.0
This release incorporates a host and slew of improvements. A large chunk of the library has been rewritten, reworked, and improved significantly.
New Features
- Properties: Instead of generated column
String
names,Property
simplify queries even further and provide type-safety. - Transactions Rewritten: Transactions have been rewritten from the ground-up to provide flexibility, better syntax, and easy customization. You can even swap out the library's system and replace it with your own.
- Database Encryption Support: via SQLCipher enables secure databases with minimal configuration and effort in DBFlow!
- Usage Docs: I rewrote usage docs to be more comprehensive and informative.
- Foreign Keys Simplified: no longer do you have to manually specify
@ForeignKey
references. - Caching with Multiple Primary Keys: Caching now supports multiple primary keys and keys of any supported type.
- Database Modules: DBFlow is supported in multiple application projects via modules. This enables sharing of Databases and their associated files.
- Better Code Generation: Support package private fields from different packages, better error messaging during compile phase, significant code gen improvements, and more.
- Kotlin Extensions Support: Via
dbflow-kotlinextensions
allows you to write better DBFlow code in Kotlin. - New SQLite features supported such as
Case
,CAST
, and more! - Many bug fixes, code comment improvements, code generation improvements, and more.
To read on the basic migration steps, read here
3.0.0-beta6
Ideally this will be the final beta before 3.0 goes live. The next release should incorporate any more bugs or issues found in 3.0, so keep reporting!
This release contains three significant updates:
- Initialization of DBFlow has changed. Now configuration of
ModelAdapter
,@Database
, and other classes can mostly be done through the newFlowConfig.Builder
class. For a simple example, view an example here - The transactions system got a complete and utter overhaul. Welcome the
Transaction.Builder
! EachTransaction
containsSuccess
andError
callbacks for easy listening. See the migration guide for guidance. By default, we no longer use a priority-based queue for transactions. To keep that, read here. You can now also specify and roll your ownITransactionQueue
orBaseTransactionManager
, read up here. - I rewrote the documentation completely for accuracy and for better organization. I hope you like!
Some new features:
- Can now use the
CASE
Operator! `SQLite.
SQLite.select(CaseModel_Table.customerId,
CaseModel_Table.firstName,
CaseModel_Table.lastName,
SQLite.caseWhen(CaseModel_Table.country.eq("USA"))
.then("Domestic")
._else("Foreign").end("CustomerGroup")).from(CaseModel.class);
- Can
Collate.LOCALIZED
andCollate.UNICODE
- Can now
multipliedBy()
,add()
,dividedBy()
,mod()
, andconcatenate()
IProperty
together. - This release contains a number of bug fixes as well here](https://github.com/Raizlabs/DBFlow/issues?q=milestone%3A3.0.0-beta6+is%3Aclosed)
3.0.0-beta5
- Fixes a critical issue where some queries (those that end off at
Where
)count()
/hasData()
when run with empty table throws aSQLiteDoneException
on the query. now suppresses exception and logs it. - can now pass in
DatabaseWrapper
into any saving methods of aModelAdapter
in order to better work in migrations! So that we do not recursively call theSQLiteDatabaseObject
. So now all CRUD operations are supported in DBFlow migrations:
ModelAdapter modelAdapter = FlowManager.getModelAdapter(SomeTable.class);
modelAdapter.save(wrapper, someModel);
modelAdapter.insert(wrapper, someModel);
3.0.0-beta4
This release contains a few major updates.
- All unit tests are now run in JVM via Robolectric
@ForeignKey
nowsaveForeignKeyModel=false
by default, since this can lead to errors or unexplained performance hits. Rather be safe to be explicit!@ManyToMany
can now specify the name of the generated join table. Also they can point to themselves (i.e.User_User
). Also can configuresaveForeignKeyModels()
for each generated@ForeignKey
.@ContentProvider
generated now call down directly to the corresponding database methods. This is to simplify and prevent most other issues from coming up.- Now there's an incubating
dbflow-kotlinextensions
! It provides some Kotlin language features such asitems.processInTransactionAsync { it.save() }
or5.property.eq(SomeTable_Table.num)
Migration
no longer require empty constructor, but also support, since this led to hard-to-find compile time errors for some people:
public TestMigration(Class<TestModel1> table) {
super(table);
}
- Versions of 3.0.0-beta1 - 3.0.0-beta3 incorrectly created tables that specified
autoincrement=true
. What happened is that it treated them like a ROWID. This is fixed in this version, and to fix it for any existing table, you must include and subclass the included migration snippet here. It will run a one-time migration check if you had used this in earlier versions of the 3.0 lib. If it doesn't affect you or seem to notice, a newrowID
param has been added to the@PrimaryKey
annotation that will keep the existing way (to prevent inconsistencies). - all wrapper queries now have access to
hasData()
which returnscount() > 0
. - All saving, updating, deleting, and inserting is now done via a configurable
ModelSaver
class. All correspondingSqlUtils
static methods have been deprecated. To specify your own subclass for any extra behavior:
FlowManager.getModelAdapter(SomeTable.class).setModelSaver(new MySubclassModelSaver());
// this might need to get configured for the corresponding `ModelContainerAdapter` if you use `@ModelContainer`.
FlowManager.getContainerAdapter(SomeTable.class).setModelSaver(new MyModelContainerSubclassModelSaver());
- Fix issues with
TypeConverter
that usedBlob
as its database class. Properly convert the blob to a hex string using a super-efficient algorithm. - Fixed null values as strings that would insert
'null'
instead of the databaseNULL
, which could lead to head-scratching why a query likeSQLite.delete(SomeTable.class).where(SomeTable_Table.column.eq(null)).execute()
would fail to delete in some scenarios. _Table
classes now give you access to an array ofIProperty
from the table viagetAllColumnProperties()
. Useful in queries or table information.- Can attached queries as properties now:
SQLite.select(SQLite.select().from(SomeTable.class).where(..)).from(SomethingElse.class)....
(SELECT (SELECT * From...)) - Doc improvements, bug fixes and more.