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
: Addsx
to the current valuedecrement: x
: Subtractsx
from the current valuemultiply: x
: Multiplies the current value byx
divide: x
: Divides the current value byx
set: x
: Sets the value tox
(equivalent todata: { 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: 'hello@world.com',
},
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, namelyinsensitiveFilters
. - In version
2.1.0
we introduced two preview features, namelyconnectOrCreate
andtransactionApi
.
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
- Rust Panic when querying a model with @@id
- Invalid
prisma/.env
leads to confusing error message - [EPIC] Re-Introspection
prisma generate
stack overflow on a large schema- [Re-Introspection] Comments in the schema are removed by re-introspection
- Self-referential one-to-many relationship query fails: "subquery has too many columns"
- Error in update with empty disconnect field
- Formatting Prisma 2 schema programmatically in JavaScript (file and string)
- Generating to a custom output path shows the wrong usage instructions
- Duplicate identifier 'Action' in
node_modules/.prisma/client/index.d.ts
- Use error code for invalid schema.prisma for reintrospection and migrate
- Stabilize Re-Introspection and integrate it into normal
introspect
- [Re-Introspection] Keep
@updatedAt
- List Relation Filter issue just in 2.5.0
- Filtering by null seems to be broken in 2.5
- JSON fields filtering stopped working in 2.5.0
- Add check of git commit during dowload tests
- Aggregate ignores @map value of field, generating an incorrect query
- Fix JSON autocompletion
- undici dependency cannot install - " Couldn't find match for "e76f6a37836537f08c2d9b7d8805d6ff21d1e744" git://github.com/mcollina/undici.git" - @prisma/engine-core
prisma-client-js
- Hide top-level client properties (as they are visible via JS code intellisense)
- Error when executing findMany query
- Log event typing breaks when adding datasources to
PrismaClient
constructor - node script hanging after disconnect
- New error after update to 2.5 for "not null" query
- Implement step 1 of atomic operations on update
migrate
- Multiple failures for error report, error report is just validation error in the end
- Report id 9877:
Error querying the database: near ",": syntax error
- Running
save
outputs connection strings if included in schema file - schema validation errors should not trigger an error reporting
language-tools
- Document and Surface "Rename" functionality better
- Remove badges from VSCode Marketplace README
- "No result" when trying to rename model where it is used as type, not in model definition
- Enum default autocompletion support
- Detect VSCode theme and tell people to use a different one for better experience
- @@map gets initialized with
[]
instead of""
when using autocompletion - Option to stop extension from creating .vscode folder in workspace
studio
- Opening relations in new tabs
- Relation "accordion" is closed when I click somewhere outside of the browser window
- Relation accordion does not indicate which items are/is connected
- Cmd+Click on a relation cell should open a new tab with appropriate filters applied to show only the connected records
- Opening the relations view is considered making a change
- Briefly displaying "No rows to shows" while loading is a bit confusing
- [feature] UX: click-through relations
- Info: The preview flags
middlewares
were removed, you can now safely remove them from your schema.prisma. - Relation table is missing a min-height
- Error when trying to add a new record
- Blank screen when trying to filter a string field
- New Tab button (+) should always create a new tab
- Clicking a relation in relation table scrolls to the row in addition to selecting it
- New record disappears when navigating away (if there are no other records in the table)
- Visual feedback when adding new row if scrolled down
- Show fatal errors instead of White Screen of Death
- Update error message to say
prisma
not@prisma/cli
- Relation table headers overlap if the model name is too long
- Some (not all) column type icons overlap the next column
skip
can be set to negative- It isn't possible to delete uncommitted records
- Ugly scrollbar in relation editor
- Save [x] changes count not valid after creating a record
- Relation editor table should have a min-height
- Inconsistent state with no tabs
- Render a separator between uncommitted & committed records
prisma-engines
- Datamodel Parser: Native Types
- Log what error caused a rollback in query engine
- Do not generate unnecessary db queries
- Adding optional relations on existing models on SQLite does not add a foreign key constraint
- Multi-line alter tables on SQLite appear not to be working
- Check that unique constraints can be added/removed from existing tables on MySQL
- Check that column arity is preserved by AlterEnum on MySQL
- Enum names must be validated that they are not using a reserved name
Credits
Huge thanks to @peter50216 for helping!