Change8

v8.0.0-rc.1-dev.42

Breaking Changes
📦 prismaView on GitHub →
3 breaking4 features🔧 10 symbols

Summary

This release refactors write operations to return affected row counts directly from the write statement, eliminating an extra round trip and race condition. It also introduces explicit separation between row retrieval (`query()`) and statistics (`execute()`) operations.

⚠️ Breaking Changes

  • The `query()` and `queryPrepared()` methods are now exclusively for retrieving rows. The `execute()` method is now exclusively for statement statistics.
  • Middleware results for incorrect operations (e.g., offering row results to `execute()` or statistics to `query()`) will now fail loudly.
  • SQL `updateAndCount` and `deleteAndCount` now execute a single non-returning write and return `stats.affectedRows`. Mongo preserves its native modified/deleted count semantics.

Migration Steps

  1. Update callers that previously used `execute()` for row retrieval to use `query()` or `queryPrepared()` instead.
  2. Update callers that previously relied on `updateAndCount` or `deleteAndCount` to fetch row data to adjust their logic to use the returned affected row count.

✨ New Features

  • Count-returning writes now report the database's affected-row result directly from the write operation, eliminating a race condition and an extra round trip previously caused by a pre-SELECT.
  • Runtime callers can now explicitly choose between `query()` / `queryPrepared()` for rows and `execute()` for statement statistics, with operation-discriminated middleware results.
  • SQL `updateAndCount` and `deleteAndCount` now execute one non-returning write and return `stats.affectedRows`.
  • Mongo preserves its native modified/deleted count semantics through the same vocabulary as SQL operations.

Affected Symbols