Releases: simolus3/drift
Drift 2.8.1
This patch release fixes the following issues in the core drift
package:
- Fix a deadlock after rolling back a transaction in a remote isolate.
- Remove unintended log messages when using
connectToDriftWorker
.
Also, drift_dev: 2.8.3
and sqlparser: 0.30.1
have been released with these changes:
- Allow Dart-defined tables to reference imported tables through SQL #2433.
- Report syntax error for
WITH
clauses in triggers.
Drift 2.8.0
This drift release adds support for named constructors for existing row types in drift files (#2399) and allows targeting partial indices in DoUpdate
(#2394).
It also fixes the following noteworthy bugs:
- Don't keep databases in an unusable state if the
setup
callback throws an exception. Instead, drift will retry the next time the database is used. - Fix deadlocks when
computeWithDatabase
is called inside atransaction()
. - Fix compilation issues with
analyzer: 5.12.0
.
Drift 2.7.0
- Add support for
CASE
expressions without a base in the Dart API with theCaseWhenExpression
class. - Add the new
package:drift/web/workers.dart
library which makes it easier to create web workers for drift. - Make
validateDatabaseSchema()
work in migration tests. - Fix queries from transitive imports in drift files not being analyzed reliably.
- Fix false-positive warnings about
AS
aliases in subqueries used in triggers. - Fix false-positive warnings about referencing a result column in a
GROUP BY
orHAVING
clause.
Drift 2.5.0
This release adds support for general IS
operators to the query builder, makes drift isolates much easier to use and allows applying type converters on columns in queries.
Query builder
- Add
isExp
,isValue
,isNotExp
andisNotValue
methods toExpression
to generate theIS
operator in SQL. - Add
all()
extension on tables and views to quickly query all rows.
Isolate improvements
- Add
serializableConnection()
andcomputeWithDatabase()
as extensions on databases. The methods allow sharing any drift database between isolates, regardless of how the database has been set up. - The
DatabaseConnection
class now implementsQueryExecutor
, meaning that you no longer need a special.connect()
constructor to use it. - The
generate_connect_constructor
option is now deprecated, as aDatabaseConnection
can be passed whereever aQueryExecutor
is used too.
Drift files
- Support
MAPPED BY
for individual columns in queries or in views defined with SQL. - Support a
CAST
to an enum type in drift files. - Consistently interpret
CAST (x AS DATETIME)
andCAST(x AS TEXT)
in drift files. - Support two different queries using
LIST()
columns having the same result class name.
Miscellaneous changes and fixes
- Fix table classes not extending defining Dart classes with modular generation.
- Fix
@UseDataClass
withextending
not working with modular generation. - Fix generating invalid code when using a type converter with a nullable JSON type.
- Avoid unecessary
async
modifier when mapping queries to existing row classes.
Drift 2.4.2
drift 2.4.2
- Fix an exception when a client disconnects from a drift remote server while processing a pending table update.
drift_dev 2.4.1
- Improvements and fixes for schema files:
- Fix views with an existing row type generating invalid SQL in schema files.
- Fix
schema generate --companions
implicitly requiring--data-classes
as well. - Fix
toColumns()
not being generated correctly. - Fix conflicting names being generated by
schema generate
when using existing row types on views.
sqlparser 0.26.0
- Remove token parameter from constructor in
Literal
subclasses andNumberedVariable
.
Drift 2.4.0
This drift release extends support for existing row classes to queries, allows storing enums by their name and handles ANY
columns. A full list of improvements and new features:
New features
- Support existing row types on queries defined in drift files.
- Enums can now be stored by their name instead of their index - use the
textEnum()
column in Dart or theENUMNAME
column type in.drift
files. - Add the
DriftAny
type to handle arbitrary SQL values. It will be used by the generator for columns types declared asANY
in strict tables. drift_dev schema dump
can now dump the schema of existing sqlite3 database files as well.- Adds the
case_from_dart_to_sql
option with the possible values:preserve
,camelCase
,CONSTANT_CASE
,snake_case
,PascalCase
,lowercase
andUPPERCASE
(default:snake_case
). - Add
updates
parameter toBatch.customStatement
- it can be used to specify which tables are affected by the custom statement. - Add
likeExp
to generateLIKE
expressions with any comparison expression.
Notable improvements
- Fix
UNIQUE
keys declared in drift files being written twice. - Lazily load columns in
TypedResult.read
, increasing performance for joins with lots of tables or columns. - Work-around an issue causing complex migrations via
Migrator.alterTable
not to work if a view references the altered table. - Warn about suspicious int or text literals being inserted into enum columns.
- For Dart-defined columns,
customConstraint
s are now parsed and respected by the generator. - It is now allowed to interleave queries and tables in a drift file.
This drift release also adds experimental support for record types as existing types for tables or queries. Note that records are experimental in the Dart language, so the feature may be updated or removed depending on its development in the language.
Drift 2.3.0
- Add the
JsonTypeConverter2
mixin. It behaves similar to the existing json type converters, but can use a different SQL and JSON type. - Add
isInValues
andisNotInValues
methods to columns with type converters. They can be used to compare the column against a list of Dart expressions that will be mapped through a type converter. - Add
TableStatements.insertAll
to atomically insert multiple rows. - Add
singleClientMode
toremote()
andDriftIsolate
connections to make the common case with one client more efficient. - Fix a concurrency issue around transactions.
- Add
NativeDatabase.createInBackground
as a drop-in replacement forNativeDatabase()
. It creates a drift isolate behind the scenes, avoiding all of the boilerplate usually involved with drift isolates. - Experimental: Add a modular generation mode in which drift will generate multiple smaller files instead of one very large one with all tables and generated queries.
Drift 2.2.0
- Potentially breaking bug-fix: Fix the nullability of columns generated for Dart-defined views. See the documentation for details.
- Always escape column names, avoiding the costs of using a regular expression to check whether they need to be escaped.
- Add extensions for binary methods on integer expressions:
operator ~
,bitwiseAnd
andbitwiseOr
. - Serialize
uniqueKeys
overrides into a database schema, allowing them to be properly tested in schema tests. - Support the latest version of the
analyzer
package.
Drift 2.1.0
Changes in drift
version 2.1.0
:
- Improve stack traces when using
watchSingle()
with a stream emitting a non-singleton list at some point. - Add
OrderingTerm.nulls
to control theNULLS FIRST
orNULLS LAST
clause in Dart.
Changes in drift_dev
version 2.1.0
and sqlparser
version 0.23.2
:
- Analysis support for
fts5
tables with external content tables. - Analysis support for the
rtree
module. - Internally prepare for an upcoming breaking analyzer change around how classes are mapped to elements.
- Improve static analysis around subqueries in SQL.
Drift 2.0.2
This patch release fixes some issues introduced by the upgrade to drift 2.0:
- drift 2.0.2: Revert the breaking change around
QueryRow.read
only returning non-nullable values now - it was causing issues with type inference in some cases. - drift_dev 2.0.2: Generate typedefs for the signatures of
scoped_dart_components
, making it easier to re-use them in your own methods. - sqlparser 0.23.1: Gracefully handle tokenizer errors related to
@
or$
variables instead of crashing.