WatermelonDB v0.19 Release Notes

Release Date: 2020-08-17 // about 1 month ago
  • ๐Ÿ†• New features

    • ๐Ÿ‘ [iOS] Added CocoaPods support - @leninlin
    • [NodeJS] Introducing a new SQLite Adapter based integration to NodeJS. This requires a ๐Ÿ‘ peer dependency on better-sqlite3 ๐Ÿ”ง and should work with the same configuration as iOS/Android - @sidferreira
    • ๐Ÿš€ [Android] exerimentalUseJSI option has been enabled on Android. However, it requires some app-specific setup which is not yet documented - stay tuned for upcoming releases
    • ๐Ÿ— [Schema] [Migrations] You can now pass unsafeSql parameters to schema builder and migration steps to modify SQL generated to set up the database or perform migrations. There's also new unsafeExecuteSql migration step. Please use this only if you know what you're doing โ€” you shouldn't need this in 99% of cases. See Schema and Migrations docs for more details
    • ๐ŸŽ [LokiJS] [Performance] Added experimental onIndexedDBFetchStart and indexedDBSerializer options to LokiJSAdapter. These can be used to improve app launch time. See src/adapters/lokijs/index.js for more details.

    ๐Ÿ”„ Changes

    • ๐ŸŽ [Performance] findAndObserve is now able to emit a value synchronously. By extension, this makes Relations put into withObservables able to render the child component in one shot. Avoiding the extra unnecessary render cycles avoids a lot of DOM and React commit-phase work, which can speed up loading some views by 30%
    • ๐ŸŽ [Performance] LokiJS is now faster (refactored encodeQuery, skipped unnecessary clone operations)

Previous changes from v0.18

  • ๐Ÿš€ Another WatermelonDB release after just a week? Yup! And it's jam-packed full of features!

    ๐Ÿ†• New features

    • [Query] Q.on queries are now far more flexible. Previously, they could only be placed at the top level of a query. See Docs for more details. Now, you can:

      • Pass multiple conditions on the related query, like so:

          Q.on('projects', [
            Q.where('foo', 'bar'),
            Q.where('bar', 'baz'),
      • You can place Q.on deeper inside the query (nested inside Q.and(), Q.or()). However, you must explicitly list all tables you're joining on at the beginning of a query, using: Q.experimentalJoinTables(['join_table1', 'join_table2']).

      • You can nest Q.on conditions inside Q.on, e.g. to make a condition on a grandchild. To do so, it's required to pass Q.experimentalNestedJoin('parent_table', 'grandparent_table') at the beginning of a query

    • [Query] Q.unsafeSqlExpr() and Q.unsafeLokiExpr() are introduced to allow adding bits of queries that are not supported by the WatermelonDB query language without having to use unsafeFetchRecordsWithSQL(). See docs for more details

    • [Query] Q.unsafeLokiFilter((rawRecord, loki) => boolean) can now be used as an escape hatch to make queries with LokiJSAdapter that are not otherwise possible (e.g. multi-table column comparisons). See docs for more details

    ๐Ÿ”„ Changes

    • ๐ŸŽ [Performance] [LokiJS] Improved performance of queries containing query comparisons on LokiJSAdapter
    • ๐Ÿ“„ [Docs] Added Contributing guide for Query language improvements
    • ๐Ÿ—„ [Deprecation] Query.hasJoins is deprecated
    • [DX] Queries with bad associations now show more helpful error message
    • [Query] Counting queries that contain Q.experimentalTake / Q.experimentalSkip is currently broken - previously it would return incorrect results, but now it will throw an error to avoid confusion. Please contribute to fix the root cause!

    ๐Ÿ›  Fixes

    • ๐Ÿ›  [Typescript] Fixed types of Relation


    • QueryDescription structure has been changed.