Releases: simolus3/drift
Drift 2.0.0
The first major update to the drift
packages contains a number of breaking changes and removes some obsolete features. This includes:
- Breaking: Type converters now return the types that they were defined to return (instead of the nullable variant of those types like before). It is an error to use a non-nullable type converter on a column that is nullable in SQL and vice-versa.
- Breaking: Mapping methods on type converters are now called
toSql
andfromSql
. - Breaking: Removed
SqlTypeSystem
and subtypes ofSqlType
:- To describe the type a column has, use the
DriftSqlType
enum - To map a value from Dart to SQL and vice-versa, use an instance of
SqlTypes
, reachable viadatabase.options.types
.
- To describe the type a column has, use the
- Breaking:
Expression
s (includingColumn
s) always have a non-nullable type parameter now. They are implicitly nullable, soTypedResult.read
now returns a nullable value. - Breaking:
QueryRow.read
can only read non-nullable values now. To read nullable values, usereadNullable
. - Breaking: Remove the
includeJoinedTableColumns
parameter onselectOnly()
. The method now behaves as if that parameter was turned off. To use columns from a joined table, add them withaddColumns
. - Breaking: Remove the
fromData
factory on generated data classes. Use themap
method on tables instead. - Add support for storing date times as (ISO-8601) strings. For details on how to use this, see the documentation.
- Consistently handle transaction errors like a failing
BEGIN
orCOMMIT
across database implementations. - Add
writeReturning
to update statements;deleteReturning
andgoAndReturn
to delete statatements. - Support nested transactions.
- Support custom collations in the query builder API.
- Custom row classes can now be constructed with static methods too. These static factories can also be asynchronous.
💡: More information on how to migrate is available in the documentation.
`drift_dev` 1.7.1
This small update to drift_dev
supports the latest version of the analyzer_plugin
package and removes usages of deprecated analyzer
APIs.
Drift 1.7.1
This minor release fixes a bug where the NativedDatabase
implementation would not dispose statements if running them threw an exception (#1917).
Drift 1.7.0
This drift release brings the following new features and improvements:
- Add the
int64()
column builder to store large integers. These integers are still stored as 64-bit ints in the database, but represented as aBigInt
in Dart. This enables better web support for integers larger than 2⁵². More details are in the documentation. - Add
filter
anddistinct
support togroupConcat
. - Fix a deadlock with the
sqflite
-based implementation if the first operation in atransaction
is a future backed by a query stream. - Support version 4.x of the
analyzer
package
This release also uses version 0.22.0 of the sqlparser
package with the following changes:
- A new resolver for tables and columns in analyzed queries. If this breaks anything for you, please open an issue!
- Lint for
DISTINCT
misuse in aggregate function calls. - Analysis support for new features in the upcoming sqlite 3.39 (
RIGHT
andFULL
joins,IS (NOT) DISTINCT FROM
expressions) - Fix type inference for
SUM()
calls around int "subtypes" like booleans.
Drift 1.6.0
- Add the
unique()
method to columns and theuniqueKeys
override to define unique constraints in Dart tables. - Add the
check()
method to the Dart column builder to generateCHECK
column constraints. - Also apply type converters for json serialization and deserialization if they mix in
JsonTypeConverter
. - Add the very experimental
package:drift/wasm.dart
library. It uses WebAssembly to access sqlite3 without any external JavaScript libraries, but requires you to add a WebAssembly module to theweb/
folder.
Please note that this specific library is not subject to semantic versioning until it leaves its experimental state. It also isn't suitable for production use at the moment. - Internally use
package:js
to wrap sql.js.
Drift 1.5.0
- Add
DataClassName.extending
to control the superclass of generated row classes. - Add
setup
parameter to the constructors ofWebDatabase
too. - Don't write variables for expressions in
CREATE VIEW
statements. - Improve stack traces for errors on a remote isolate.
- Add
MultiExecutor.withReadPool
constructor to load-balance between multiple reading executors. This can be used in a multi-isolate approach if some queries are expensive.
drift_dev
also has new features:
- Add
validateDatabaseSchema
extension topackage:drift_dev/api/migrations.dart
. It validates that the schema of a database at runtime matches what one would expect. This can be used to test the correctness of migrations at runtime without special testing code. - New features in sqlite 3.38 are supported in analyzed queries and drift files when changing the dialect version in the build options.
Drift 1.4.0
1.4.0
- Most methods to compose statements are now available as an extension on tables. As an alternative to
update(todos).replace(newEntry)
, you can now writetodos.replaceOne(newEntry)
. - Deprecate the
from(table)
API introduced in 1.3.0. Having the methods on the table instances turned out to be even easier! - In drift files, you can now use
LIST(SELECT ...)
as a result column to get all results of the inner select as aList
in the result set.
Drift 1.3.0
- Add the
from(table)
method to generated databases. It can be used to write common queries more concisely. - Make
groupConcat
nullable in the Dart API. - Throw an exception in a
NativeDatabase
when multiple statements are run in a single call. In previous versions, parts of the SQL string would otherwise be ignored. - Close the underlying database when a drift isolate is shut down.
drift_dev 1.2.1
- Support the latest versions of
analyzer
andanalyzer_plugin
.
Drift 1.2.0
This minor release implements changes in the generated code necessary to support streams from views in the Dart API.
Additionally,
- Reading blobs from the database is more lenient now.
watchSingle()
andwatchSingleOrNull()
now throws an error with a stack trace when used on a query emitting multiple rows.- With
sqlparser
0.19.1,group_concat
was made nullable as evaluates toNULL
for empty groups.