WatermelonDB v0.17 Release Notes

Release Date: 2020-06-22 // about 2 years 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

    Internal

    • ๐Ÿ›  Fixed broken adapter tests