WatermelonDB v0.17 Release Notes
Release Date: 2020-06-22 // almost 4 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
toSQLiteAdapter
constructor.[Query] Added
Q.experimentalSortBy(sortColumn, sortOrder)
,Q.experimentalTake(count)
,Q.experimentalSkip(count)
methods (only availble with SQLiteAdapter) - @Kenneth-KTDatabase.batch()
can now be called with a single array of models[DX]
Database.get(tableName)
is now a shortcut forDatabase.collections.get(tableName)
[DX] Query is now thenable - you can now use
await query
andawait query.count
instead ofawait query.fetch()
andawait query.fetchCount()
[DX] Relation is now thenable - you can now use
await relation
instead ofawait relation.fetch()
[DX] Exposed
collection.db
andmodel.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