Prisma: 2.6.0 Release

Release date:
August 25, 2020
Previous version:
2.5.1 (released August 20, 2020)
Magnitude:
208 Diff Delta
Contributors:
5 total committers
Data confidence:
Commits:

22 Commits in this Release

Ordered by the degree to which they evolved the repo in this version.

Authored August 21, 2020
Authored August 24, 2020
Authored August 20, 2020
Authored August 24, 2020
Authored August 20, 2020
Authored August 20, 2020
Authored August 24, 2020

Top Contributors in 2.6.0

Jolg42
marcjulian
janpio
timsuchanek
renovate-bot

Directory Browser for 2.6.0

We haven't yet finished calculating and confirming the files and directories changed in this release. Please check back soon.

Release Notes Published

Today we are excited to share the 2.6.0 stable release.

🌟 Help us spread the word about Prisma by starring the repo ☝️ or tweeting about the release.

Major improvements

More robust introspection by keeping manual changes in the Prisma schema file

In prior releases, any manual changes to your Prisma schema would be overridden when invoking prisma introspect (e.g. usage of @map or @@map as well as the renaming of relation fields).

Keeping these manual changes in the Prisma schema file has been available as a preview feature via the --experimental-reintrospection already. After getting tested as a preview feature for a few releases, we are excited to promote this functionality to be the default behavior of prisma introspect into this stable release.

Note that you can opt-out of this behavior by using the new --force flag: prisma introspect --force. This will generate a schema purely based on the introspected database and override any prior manual changes.

πŸ“š Documentation: Prisma Introspect

Preview features

New: Atomic number operations on update

With today's release, we introduce atomic number operations for update queries in Prisma Client. It allows you to update the values of certain fields atomically.

Feature flag

Atomic number operations needs to be enabled with the feature flag atomicNumberOperations like so:

generator client {
  provider        = "prisma-client-js"
  previewFeatures = ["atomicNumberOperations"]
}

Usage

We are introducing five atomic operations for Int and Float fields :

  • increment: x: Adds x to the current value
  • decrement: x: Subtracts x from the current value
  • multiply: x: Multiplies the current value by x
  • divide: x: Divides the current value by x
  • set: x: Sets the value to x (equivalent to data: { age: 18 })

Note: Only one operation can be done per field at a time.

Here's an example of using the new operations:

const result = await prisma.user.update({
  where: {
    email: '[email protected]',
  },
  data: {
    points: {
      set: 99, // this just sets the value, equivalent to `data: { points: 18 }`
    },
    age: {
      increment: 1, // age = age + 1 - Happy Birthday!
    },
    credits: {
     decrement: 2, // credits = credits - 2
    },
    karma: {
      multiply: 3, // karma = karma * 3
    },
    chocolates: {
      divide: 4, // chocolates = chocolates / 4
    },
  },
})

πŸ“š Documentation: Atomic operations on update

Please share your feedback on how this feature works for you. We are interested in both positive and negative feedback, so we know if this feature is already ready for production! (If encounter any problems, please open a new issue here).

Already existing preview features from previous releases

Just a quick reminder:

  • In version 2.5.0 we introduced one preview feature, namely insensitiveFilters.
  • In version 2.1.0 we introduced two preview features, namely connectOrCreate and transactionApi.

In case they're useful for you, please give them a try and share your feedback! These features remain in preview in this release.

πŸ€” How would you describe Prisma?

We'd love to hear from you how you describe Prisma to your developer friends and coworkers. If you have 2 minutes, please answer this question via this online form.

🌟 Help us spread the word about Prisma

To help spread the word about Prisma, we'd very much appreciate if you would star this repo 🌟 And if you're excited about the features in this week's release, then help us and share it on Twitter.

Fixes and improvements

prisma

prisma-client-js

migrate

language-tools

studio

prisma-engines

Credits

Huge thanks to @peter50216 for helping!