Skip to content

Releases: simolus3/drift

Drift 1.1.1

23 Dec 17:05
286612d
Compare
Choose a tag to compare

This patch release contains the following changes:

  • Rollback transactions when a commit fails.
  • Revert a change from 1.1.0 to stop serializing messages over isolates. Instead, please set the serialize parameter to false on the DriftIsolate methods.

The generator, released as drift_dev version 1.1.1 contains a fix related to custom row classes with generateInsertable: true.

Drift 1.1.0

11 Dec 13:24
c4e2600
Compare
Choose a tag to compare

This release consists of drift version 1.1.0, drift_dev version 1.1.0 and sqlparser version 0.19.0:

  • Add the references method to BuildColumn to reference a column declared in another Dart table.
  • Add the generateInsertable option to @UseRowClass. When enabled, the generator will emit an extension to use the row class as an Insertable.
  • Allow the generator to emit correct SQL code when using arrays with the new_sql_code_generation option in specific scenarios.
  • Add support for strict tables in .drift files.
  • Add the generatedAs method to declare generated columns for Dart tables.
  • Add OrderingTerm.random to fetch rows in a random order.
  • Improved support for pausing query stream subscriptions. Instead of buffering events, query streams will suspend fetching data if all listeners are paused.
  • Drift isolates no longer serialize messages into a primitive format. This will reduce the overhead of using isolates with Drift.
  • Initial support for STRICT tables defined in .drift files.
  • Support for generated columns for tables defined in .drift files.

Big thanks to everyone who contributed to this release!

sqlparser-0.18.1

02 Dec 12:19
877a349
Compare
Choose a tag to compare

This hotfix release fixes a bug when comparing AST nodes with a different amount of children (#1575). The broken comparison may have caused false-positives in migration tests.

Drift-dev 1.0.2

13 Oct 21:00
b574cb0
Compare
Choose a tag to compare

With this release, running moor_generator migrate will also rewrite usages of the moor plugin in an analysis_options.yaml file.

Drift 1.0.1, Moor 4.6.0

12 Oct 13:34
6b03003
Compare
Choose a tag to compare
  • Add DoUpdate.withExcluded to refer to the excluded row in an upsert clause.
  • Add optional where clause to DoUpdate constructors

Please note

With this release, moor has been renamed to drift. No immediate action is necessary, the moor package will continue to work until the next breaking release. The functionality of moor 4.6.0 is identical to drift 1.0.1.

An automatic migration tool can help you make the switch from moor to drift in minutes. See the documentation for all the details. Thanks!

Moor ffi 0.3.0

18 Dec 22:01
e983e4d
Compare
Choose a tag to compare

0.3.0

  • Better setup for compiling sqlite3 on Android
    • Compilation options to increase runtime performance, enable fts5 and json1
    • We no longer download sqlite sources on the first run, they now ship with the plugin

2.0.1+1

20 Oct 19:36
71247bd
Compare
Choose a tag to compare

Version 2.0.1+1 version of the moor package fixes #199, a bug that causes your app to crash when you use customStatement directly after opening the database.

2.0.1

11 Oct 15:41
77fcf7a
Compare
Choose a tag to compare
  • Introduced isBetween and isBetweenValues methods for comparable expressions (int, double, datetime)
    to check values for both an upper and lower bound
  • Automatically map BOOLEAN and DATETIME columns declared in a sql file to the appropriate type
    (both used to be double before).
  • Fix streams not emitting cached data when listening multiple times
  • Accept \r as whitespace in moor files and compiled queries
  • Breaking: Remove the type parameter from Insertable.createCompanion (it was declared as an
    internal method, but you will have to re-run the build)

Version 2.0.0

03 Oct 20:47
364e3f0
Compare
Choose a tag to compare

2.0.0

This is the first major update after the initial release and moor and we have a lot to cover:
.moor files can now have their own imports and queries, you can embed Dart in sql queries
using the new templates feature and we have a prototype of a pure-Dart SQL IDE ready.
Finally, we also removed a variety of deprecated features. See the breaking changes
section to learn what components are affected and what alternatives are available.

New features

Updates to the sql parser

.moor files were introduced in moor 1.7 as an experimental way to declare tables by using
CREATE TABLE statements. In this version, they become stable and support their own import
and query system. This allows you to write queries in their own file:

CREATE TABLE users (
  id INT NOT NULL PRIMARY KEY AUTOINCREMENT,
  name VARCHAR NOT NULL
);

findByName: SELECT * FROM users WHERE name LIKE :query;

When this file is included from a @UseMoor annotation, moor will generate methods to run the
query. Of course, you can also write Dart queries for tables declared in sql:

Stream<User> loadUserById(int id) {
 return (select(users)..where((u) => u.id.equals(2))).watchSingle();
}

Moor files can also import other moor files by using an import 'other.moor'; statement at the
top. Then, all tables defined in other.moor will also be available to the current file.

Moor takes Dart and SQL interop even further with the new "Dart in SQL templates". You can define
a query like this:

findDynamic: SELECT * FROM users WHERE $condition;

And moor will generate a method findDynamic(Expression<bool, BoolType> condition) for you. This
allows you to bind the template with a predicate as complex as you'd like. At the moment, Dart
templates are supported for expressions, OrderBy, OrderingTerm and Limit.

INSERT statements can now be used as a compiled statement - both in moor files and
in a @UseMoor or @UseDao annotation. A new builtin linter will even warn you when you forget
to provide a value for a non-nullable column - right at compile time!

And finally, we now generate better query code when queries only return a single column. Instead of
generating a whole new class for that, we simply return the value directly.

Experimental ffi support

We released an experimental version of moor built on top of dart:ffi. It works
cross-platform and is much, much faster than moor_flutter. It you want to try
it out, read the docs here.

Minor changes

  • a Constant<String> can now be written to SQL, it used to throw before. This is useful
    if you need default values for strings columns. This also works for BLOBS
    (Constant<Uint8List>).
  • new LazyDatabase for when you want to construct a database asynchronously (for instance, if
    you first need to find a file before you can open a database).

Breaking changes

  • THIS LIKELY AFFECTS YOUR APP: Removed the transaction parameter for callbacks
    in transactions and beforeOpen callbacks. So, instead of writing

    transaction((t) async {
      await t.update(table)...;
    });

    simply write

    transaction(() async {
      await update(table)...;
    });

    Similarly, instead of using onOpen: (db, details) async {...}, use
    onOpen: (details) async {...}. You don't have to worry about calling methods on
    your database instead of a transaction objects. They will be delegated automatically.

    On a similar note, we also removed the operateOn parameter from compiled queries.

  • Compiled queries that return only a single column (e.g. SELECT COUNT(*) FROM users)
    will just return their value (in this case, an int) now. Moor no longer generates a
    new class in that case.

  • Removed MigrationStrategy.onFinished. Use beforeOpen instead.

  • Compiled sql queries starting with an underscore will now generate private match queries.
    Previously, the query _allUsers would generate a watchAllUsers method, that has been
    adopted to _watchAllUsers. The generate_private_watch_methods builder option, which
    backported this fix to older versions, has thus been removed.

  • Removed InsertStatement.insertOrReplace. Use insert(data, orReplace: true) instead.

  • Removed the diff util and MoorAnimatedList. Use a third party library for that.

Version 1.7

24 Aug 19:40
e38719a
Compare
Choose a tag to compare
  • Support custom columns via type converters. See the docs for details on how to use this feature.
  • Transactions now roll back when not completed successfully, they also rethrow the exception to make debugging easier.
  • New backends api, making it easier to write database drivers that work with moor. Apart from moor_flutter, new experimental backends can be checked out from git:
    1. encrypted_moor: An encrypted moor database: https://github.com/simolus3/moor/tree/develop/extras/encryption
    2. moor_mysql: Work in progress mysql backend for moor. https://github.com/simolus3/moor/tree/develop/extras/mysql
  • The compiled sql feature is no longer experimental and will stay stable until a major version bump
  • New, experimental support for .moor files! Instead of declaring your tables in Dart, you can choose to declare them with sql by writing the CREATE TABLE statement in a .moor file. You can then use these tables in the database and with daos by using the include parameter on @UseMoor and @UseDao. Again, please notice that this is an experimental api and there might be some hiccups. Please report any issues you run into.

Also see the full changelog for the relases from 1.2 to 1.6.