Skip to content

Releases: simolus3/drift

Drift 2.7.0

10 Apr 21:49
drift-2.7.0
d7f1bfb
Compare
Choose a tag to compare
  • Add support for CASE expressions without a base in the Dart API with the CaseWhenExpression 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 or HAVING clause.

Drift 2.5.0

29 Jan 15:58
drift-2.5.0
e42dd91
Compare
Choose a tag to compare

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 and isNotValue methods to Expression to generate the IS operator in SQL.
  • Add all() extension on tables and views to quickly query all rows.

Isolate improvements

  • Add serializableConnection() and computeWithDatabase() 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 implements QueryExecutor, meaning that you no longer need a special .connect() constructor to use it.
  • The generate_connect_constructor option is now deprecated, as a DatabaseConnection can be passed whereever a QueryExecutor 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) and CAST(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 with extending 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

03 Jan 10:45
fafcf11
Compare
Choose a tag to compare

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 and NumberedVariable.

Drift 2.4.0

29 Dec 11:23
a98890b
Compare
Choose a tag to compare

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 the ENUMNAME 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 as ANY 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 and UPPERCASE (default: snake_case).
  • Add updates parameter to Batch.customStatement - it can be used to specify which tables are affected by the custom statement.
  • Add likeExp to generate LIKE 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, customConstraints 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

27 Nov 18:05
a837e51
Compare
Choose a tag to compare
  • Add the JsonTypeConverter2 mixin. It behaves similar to the existing json type converters, but can use a different SQL and JSON type.
  • Add isInValues and isNotInValues 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 to remote() and DriftIsolate 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 for NativeDatabase(). 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

06 Oct 11:52
a2e10d9
Compare
Choose a tag to compare
  • 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 and bitwiseOr.
  • 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

29 Aug 21:16
ce35a27
Compare
Choose a tag to compare

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 the NULLS FIRST or NULLS 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

21 Aug 12:02
a12a2b8
Compare
Choose a tag to compare

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.

Drift 2.0.0

14 Aug 15:56
d9f342a
Compare
Choose a tag to compare

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 and fromSql.
  • Breaking: Removed SqlTypeSystem and subtypes of SqlType:
    • 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 via database.options.types.
  • Breaking: Expressions (including Columns) always have a non-nullable type parameter now. They are implicitly nullable, so TypedResult.read now returns a nullable value.
  • Breaking: QueryRow.read can only read non-nullable values now. To read nullable values, use readNullable.
  • Breaking: Remove the includeJoinedTableColumns parameter on selectOnly(). The method now behaves as if that parameter was turned off. To use columns from a joined table, add them with addColumns.
  • Breaking: Remove the fromData factory on generated data classes. Use the map 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 or COMMIT across database implementations.
  • Add writeReturning to update statements; deleteReturning and goAndReturn 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

09 Aug 21:50
092a427
Compare
Choose a tag to compare

This small update to drift_dev supports the latest version of the analyzer_plugin package and removes usages of deprecated analyzer APIs.