WatermelonDB v0.17 Release Notes

Release Date: 2020-06-22 // 14 days ago
  • πŸ†• New features

    • πŸ”€ [Sync] Introducing Migration Syncs - this allows fully consistent synchronization when migrating between schema versions. Previously, there was no mechanism to incrementally fetch all remote changes in new tables and columns after a migration - so local copy was likely inconsistent, requiring a re-login. After adopting migration syncs, Watermelon Sync will request from backend all missing information. See Sync docs for more details.
    • [iOS] Introducing a new native SQLite database integration, rewritten from scratch in C++, based on React Native's JSI (JavaScript Interface). It is to be considered experimental, however we intend to make it the default (and eventually, the only) implementation. In a later release, Android version will be introduced.

      The new adapter is up to 3x faster than the previously fastest synchronous: true option, however this speedup is only achieved with some unpublished React Native patches.

      To try out JSI, add experimentalUseJSI: true to SQLiteAdapter constructor.

    • [Query] Added Q.experimentalSortBy(sortColumn, sortOrder), Q.experimentalTake(count), Q.experimentalSkip(count) methods (only availble with SQLiteAdapter) - @Kenneth-KT

    • Database.batch() can now be called with a single array of models

    • [DX] Database.get(tableName) is now a shortcut for Database.collections.get(tableName)

    • [DX] Query is now thenable - you can now use await query and await query.count instead of await query.fetch() and await query.fetchCount()

    • [DX] Relation is now thenable - you can now use await relation instead of await relation.fetch()

    • [DX] Exposed collection.db and model.db as shortcuts to get to their Database object

    πŸ”„ Changes

    • [Hardening] Column and table names starting with __, Object property names (e.g. constructor), and some reserved keywords are now forbidden
    • πŸ— [DX] [Hardening] QueryDescription builder methods do tighter type checks, catching more bugs, and preventing users from unwisely passing unsanitized user data into Query builder methods
    • [DX] [Hardening] Adapters check early if table names are valid
    • [DX] Collection.find reports an error more quickly if an obviously invalid ID is passed
    • [DX] Intializing Database with invalid model classes will now show a helpful error
    • [DX] DatabaseProvider shows a more helpful error if used improperly
    • πŸ— [Sync] Sync no longer fails if pullChanges returns collections that don't exist on the frontend - shows a warning instead. This is to make building backwards-compatible backends less error-prone
    • πŸ“š [Sync] [Docs] Sync documentation has been rewritten, and is now closer in detail to a formal specification
    • πŸ‘ [Hardening] database.collections.get() better validates passed value
    • [Hardening] Prevents unsafe strings from being passed as column name/table name arguments in QueryDescription

    πŸ›  Fixes

    • πŸ”€ [Sync] Fixed RangeError: Maximum call stack size exceeded when syncing large amounts of data - @leninlin
    • πŸ›  [iOS] Fixed a bug that could cause a database operation to fail with an (6) SQLITE_LOCKED error
    • πŸ— [iOS] Fixed 'jsi/jsi.h' file not found when building at the consumer level. Added path $(SRCROOT)/../../../../../ios/Pods/Headers/Public/React-jsi to Header Search Paths (issue #691) - @victorbutler
    • [Native] SQLite keywords used as table or column names no longer crash
    • πŸ›  Fixed potential issues when subscribing to database, collection, model, queries passing a subscriber function with the same identity more than once


    • πŸ›  Fixed broken adapter tests

Previous changes from v0.16.1

  • πŸ”„ Changes

    • Database.unsafeResetDatabase() is now less unsafe β€”Β more application bugs are being caught

    πŸ›  Fixes

    • πŸ— [iOS] Fix build in apps using Flipper
    • [Typescript] Added type definition for setGenerator.
    • πŸ›  [Typescript] Fixed types of decorators.
    • βœ… [Typescript] Add Tests to test Types.
    • πŸ›  Fixed typo in learn-to-use docs.
    • πŸ›  [Typescript] Fixed types of changes.


    • [SQLite] Infrastruture for a future JSI adapter has been added