Skip to content

Drift 2.4.0

Compare
Choose a tag to compare
@simolus3 simolus3 released this 29 Dec 11:23
· 1283 commits to develop since this release
a98890b

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.