All Versions
61
Latest Version
Avg Release Cycle
35 days
Latest Release
883 days ago

Changelog History
Page 1

  • v0.24 Changes

    October 28, 2021

    ๐Ÿ’ฅ BREAKING CHANGES

    • Q.experimentalSortBy, Q.experimentalSkip, Q.experimentalTake have been renamed to Q.sortBy, Q.skip, Q.take respectively
    • โšก๏ธ RxJS has been updated to 7.3.0. If you're not importing from rxjs in your app, this doesn't apply to you. If you are, read RxJS 7 breaking changes: https://rxjs.dev/deprecations/breaking-changes

    ๐Ÿ†• New features

    • LocalStorage. database.localStorage is now available
    • sortBy, skip, take are now available in LokiJSAdapter as well
    • Disposable records. Read-only records that cannot be saved in the database, updated, or deleted and only exist for as long as you keep a reference to them in memory can now be created using collection.disposableFromDirtyRaw(). This is useful when you're adding online-only features to an otherwise offline-first app.
    • ๐Ÿ”€ [Sync] experimentalRejectedIds parameter now available in push response to allow partial rejection of an otherwise successful sync

    ๐Ÿ›  Fixes

    • ๐Ÿ›  Fixes an issue when using Headless JS on Android with JSI mode enabled - pass usesExclusiveLocking: true to SQLiteAdapter to enable
    • ๐Ÿ›  Fixes Typescript annotations for Collection and adapters/sqlite
  • v0.23 Changes

    July 22, 2021

    ๐Ÿš€ This is a big release to WatermelonDB with new advanced features, great performance improvements, and important fixes to JSI on Android.

    โฌ†๏ธ Please don't get scared off the long list of breaking changes - they are all either simple Find&Replace renames or changes to internals you probably don't use. It shouldn't take you more than 15 minutes to upgrade to 0.23.

    ๐Ÿ’ฅ BREAKING CHANGES

    • iOS Installation change. You need to add this line to your Podfile: pod 'simdjson', path: '../node_modules/@nozbe/simdjson'
    • ๐Ÿšš Deprecated new Database({ actionsEnabled: false }) options is now removed. Actions are always enabled.
    • ๐Ÿ”€ Deprecated new SQLiteAdapter({ synchronous: true }) option is now removed. Use { jsi: true } instead.
    • ๐Ÿšš Deprecated Q.unsafeLokiFilter is now removed. Use Q.unsafeLokiTransform((raws, loki) => raws.filter(raw => ...)) instead.
    • ๐Ÿšš Deprecated Query.hasJoins is now removed
    • ๐Ÿ”„ Changes to LokiJSAdapter constructor options:
      • indexedDBSerializer -> extraIncrementalIDBOptions: { serializeChunk, deserializeChunk }
      • onIndexedDBFetchStart -> extraIncrementalIDBOptions: { onFetchStart }
      • onIndexedDBVersionChange -> extraIncrementalIDBOptions: { onversionchange }
      • autosave: false -> extraLokiOptions: { autosave: false }
    • ๐Ÿ”„ Changes to Internal APIs. These were never meant to be public, and so are unlikely to affect you:
      • Model._isCommited, ._hasPendingUpdate, ._hasPendingDelete have been removed and changed to Model._pendingState
      • Collection.unsafeClearCache() is no longer exposed
    • Values passed to adapter.setLocal() are now validated to be strings. This is technically a bug fix, since local storage was always documented to only accept strings, however applications may have relied on this lack of validation. Adding this validation was necessary to achieve consistent behavior between SQLiteAdapter and LokiJSAdapter
    • ๐Ÿ‘€ unsafeSql passed to appSchema will now also be called when dropping and later recreating all database indices on large batches. A second argument was added so you can distinguish between these cases. See Schema docs for more details.
    • ๐Ÿ”„ Changes to sync change tracking. The behavior of record._raw._changed and record._raw._status (a.k.a. record.syncStatus) has changed. This is unlikely to be a breaking change to you, unless you're writing your own sync engine or rely on these low-level details.
      • Previously, _changed was always empty when _status=created. Now, _changed is not populated during initial creation of a record, but a later update will add changed fields to _changed. This change was necessary to fix a long-standing Sync bug.

    ๐Ÿ—„ Deprecations

    • ๐Ÿ—„ database.action(() => {}) is now deprecated. Use db.write(() => {}) instead (or db.read(() => {}) if you only need consistency but are not writing any changes to DB)
    • ๐Ÿ—„ @action is now deprecated. Use @writer or @reader instead
    • ๐Ÿ—„ .subAction() is now deprecated. Use .callReader() or .callWriter() instead
    • ๐Ÿ—„ Collection.unsafeFetchRecordsWithSQL() is now deprecated. Use collection.query(Q.unsafeSqlQuery("select * from...")).fetch() instead.

    ๐Ÿ†• New features

    • db.write(writer => { ... writer.batch() }) - you can now call batch on the interface passed to a writer block
    • Fetching record IDs and unsafe raws. You can now optimize fetching of queries that only require IDs, not full cached records:
      • await query.fetchIds() will return an array of record ids
      • await query.unsafeFetchRaw() will return an array of unsanitized, unsafe raw objects (use alongside Q.unsafeSqlQuery to exclude unnecessary or include extra columns)
      • advanced adapter.queryIds(), adapter.unsafeQueryRaw are also available
    • Raw SQL queries. New syntax for running unsafe raw SQL queries:
      • collection.query(Q.unsafeSqlQuery("select * from tasks where foo = ?", ['bar'])).fetch()
      • You can now also run .fetchCount(), .fetchIds() on SQL queries
      • You can now safely pass values for SQL placeholders by passing an array
      • You can also observe an unsafe raw SQL query -- with some caveats! refer to documentation for more details
    • Unsafe raw execute. You can now execute arbitrary SQL queries (SQLiteAdapter) or access Loki object directly (LokiJSAdapter) using adapter.unsafeExecute -- see docs for more details
    • Turbo Login. You can now speed up the initial (login) sync by up to 5.3x with Turbo Login. See Sync docs for more details.
    • ๐Ÿ–จ New diagnostic tool - debugPrintChanges. See Sync documentation for more details

    ๐ŸŽ Performance

    • The order of Q. clauses in a query is now preserved - previously, the clauses could get rearranged and produce a suboptimal query
    • โšก๏ธ [SQLite] adapter.batch() with large numbers of created/updated/deleted records is now between 16-48% faster
    • [LokiJS] Querying and finding is now faster - unnecessary data copy is skipped
    • [jsi] 15-30% faster querying on JSC (iOS) when the number of returned records is large
    • [jsi] up to 52% faster batch creation (yes, that's on top of the improvement listed above!)
    • ๐Ÿ›  Fixed a performance bug that caused observed items on a list observer with .observeWithColumns() to be unnecessarily re-rendered just before they were removed from the list

    ๐Ÿ”„ Changes

    • ๐Ÿ”Š All Watermelon console logs are prepended with a ๐Ÿ‰ tag
    • Extra protections against improper use of writers/readers (formerly actions) have been added
    • โš  Queries with multiple top-level Q.on('table', ...) now produce a warning. Use Q.on('table', [condition1, condition2, ...]) syntax instead.
    • [jsi] WAL mode is now used

    ๐Ÿ›  Fixes

    • [jsi] Fix a race condition where commands sent to the database right after instantiating SQLiteAdapter would fail
    • [jsi] Fix incorrect error reporting on some sqlite errors
    • [jsi] Fix issue where app would crash on Android/Hermes on reload
    • [jsi] Fix IO errors on Android
    • โšก๏ธ [sync] Fixed a long-standing bug that would cause records that are created before a sync and updated during sync's push to lose their most recent changes on a subsequent sync

    Internal

    • Internal changes to SQLiteAdapter:
      • .batch is no longer available on iOS implementation
      • .batch/.batchJSON internal format has changed
      • .getDeletedRecords, destroyDeletedRecords, setLocal, removeLocal is no longer available
    • encoded SQLiteAdapter schema has changed
    • LokiJSAdapter has had many internal changes
  • v0.22 Changes

    May 07, 2021

    ๐Ÿ’ฅ BREAKING CHANGES

    • [SQLite] experimentalUseJSI: true option has been renamed to jsi: true

    ๐Ÿ—„ Deprecations

    • ๐Ÿšš [LokiJS] Q.unsafeLokiFilter is now deprecated and will be removed in a future version. Use Q.unsafeLokiTransform((raws, loki) => raws.filter(raw => ...)) instead.

    ๐Ÿ†• New features

    • ๐Ÿ‘€ [SQLite] [JSI] jsi: true now works on Android - see docs for installation info

    ๐ŸŽ Performance

    • โœ‚ Removed dependency on rambdax and made the util library smaller
    • Faster withObservables

    ๐Ÿ”„ Changes

    • ๐Ÿ”€ Synchronization: pushChanges is optional, will not calculate local changes if not specified.
    • โšก๏ธ withObservables is now a dependency of WatermelonDB for simpler installation and consistent updates. You can (and generally should) delete @nozbe/with-observables from your app's package.json
    • ๐Ÿ“„ [Docs] Add advanced tutorial to share database across iOS targets - @thiagobrez
    • [SQLite] Allowed callbacks (within the migrationEvents object) to be passed so as to track the migration events status ( onStart, onSuccess, onError ) - @avinashlng1080
    • [SQLite] Added a dev-only Query._sql() method for quickly extracting SQL from Queries for debugging purposes

    ๐Ÿ›  Fixes

    • Non-react statics hoisting in withDatabase()
    • ๐Ÿ›  Fixed incorrect reference to process, which can break apps in some environments (e.g. webpack5)
    • ๐Ÿ›  [SQLite] [JSI] Fixed JSI mode when running on Hermes
    • ๐Ÿ›  Fixed a race condition when using standard fetch methods alongside Collection.unsafeFetchRecordsWithSQL - @jspizziri
    • withObservables shouldn't cause any RxJS issues anymore as it no longer imports RxJS
    • ๐Ÿ›  [Typescript] Added onSetUpError and onIndexedDBFetchStart fields to LokiAdapterOptions; fixes TS error - @3DDario
    • ๐Ÿšš [Typescript] Removed duplicated identifiers useWebWorker and useIncrementalIndexedDB in LokiAdapterOptions - @3DDario
    • 0๏ธโƒฃ [Typescript] Fix default export in logger util
  • v0.21 Changes

    March 24, 2021

    ๐Ÿ’ฅ BREAKING CHANGES

    • โš  [LokiJS] useWebWorker and useIncrementalIndexedDB options are now required (previously, skipping them would only trigger a warning)

    ๐Ÿ†• New features

    • โšก๏ธ [Model] Model.update method now returns updated record
    • ๐ŸŒฒ [adapters] onSetUpError: Error => void option is added to both SQLiteAdapter and LokiJSAdapter. Supply this option to catch initialization errors and offer the user to reload or log out
    • [LokiJS] new extraLokiOptions and extraIncrementalIDBOptions options
    • ๐Ÿ‘ [Android] Autolinking is now supported.
      • If You upgrade to <= v0.21.0 AND are on a version of React Native which supports Autolinking, you will need to remove the config manually linking WatermelonDB.
      • You can resolve this issue by REMOVING the lines of config from your project which are added in the Manual Install ONLY section of the Android Install docs.

    ๐ŸŽ Performance

    • ๐ŸŽ [LokiJS] Improved performance of launching the app

    ๐Ÿ”„ Changes

    • ๐Ÿ—„ [LokiJS] useWebWorker: true and useIncrementalIndexedDB: false options are now deprecated. If you rely on these features, please file an issue!
    • ๐Ÿ”€ [Sync] Optional log passed to sync now has more helpful diagnostic information
    • ๐Ÿ‘€ [Sync] Open-sourced a simple SyncLogger you can optionally use. See docs for more info.
    • ๐Ÿ”€ [SQLiteAdapter] synchronous:true option is now deprecated and will be replaced with experimentalUseJSI: true in the future. Please test if your app compiles and works well with experimentalUseJSI: true, and if not - file an issue!
    • 0๏ธโƒฃ [LokiJS] Changed default autosave interval from 250 to 500ms
    • [Typescript] Add experimentalNestedJoin definition and unsafeSqlExpr clause

    ๐Ÿ›  Fixes

    • ๐Ÿ›  [LokiJS] Fixed a case where IndexedDB could get corrupted over time
    • [Resilience] Added extra diagnostics for when you encounter the Record ID aa#bb was sent over the bridge, but it's not cached error and a recovery path (LokiJSAdapter-only). Please file an issue if you encounter this issue!
    • ๐Ÿ›  [Typescript] Fixed type on OnFunction to accept and in join
    • ๐Ÿ›  [Typescript] Fixed type database#batch(records)'s argument records to accept mixed types

    Internal

    • โž• Added an experimental mode where a broken database state is detected, further mutations prevented, and the user notified
  • v0.20 Changes

    October 05, 2020

    ๐Ÿ’ฅ BREAKING CHANGES

    ๐Ÿš€ This release has unintentionally broken RxJS for some apps using with-observables. If you have this issue, please update @nozbe/with-observables to the latest version.

    ๐Ÿ†• New features

    • ๐Ÿ‘€ [Sync] Conflict resolution can now be customized. See docs for more details
    • ๐Ÿ‘ [Android] Autolinking is now supported
    • ๐Ÿ”ง [LokiJS] Adapter autosave option is now configurable

    ๐Ÿ”„ Changes

    • ๐Ÿ”จ Interal RxJS imports have been refactor such that rxjs-compat should never be used now
    • ๐ŸŽ [Performance] Tweak Babel config to produce smaller code
    • ๐ŸŽ [Performance] LokiJS-based apps will now take up to 30% less time to load the database (id and unique indicies are generated lazily)

    ๐Ÿ›  Fixes

    • ๐Ÿ›  [iOS] Fixed crash on database reset in apps linked against iOS 14 SDK
    • ๐ŸŒ [LokiJS] Fix Q.like being broken for multi-line strings on web
    • ๐Ÿ›  Fixed warn "import cycle" from DialogProvider (#786) by @gmonte.
    • ๐Ÿ›  Fixed cache date as instance of Date (#828) by @djorkaeffalexandre.
  • v0.19 Changes

    August 17, 2020

    ๐Ÿ†• 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)
  • v0.18 Changes

    June 30, 2020

    ๐Ÿš€ 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:

        collection.query(
          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

    Internal

    • QueryDescription structure has been changed.
  • v0.17.1 Changes

    June 24, 2020
    • ๐Ÿ›  Fixed broken iOS build - @mlecoq
  • v0.17 Changes

    June 22, 2020

    ๐Ÿ†• 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
  • v0.17.0-7

    June 18, 2020