We hope everyone enjoyed their holidays and recharged for 2021! Today, we are excited to share the 2.14.0
stable release 🎉
🌟 Help us spread the word about Prisma by starring the repo or tweeting about the release.
Major improvements
Group By queries are now in Preview
Prisma Client now supports group by queries! Opt-in to this feature by adding the groupBy
flag to the generator
block in your Prisma schema:
generator client {
provider = "prisma-client-js"
+ previewFeatures = ["groupBy"]
}
model Agent {
id String @id
name String
location String
rate Float
}
Now you can re-generate your Prisma Client to have access to the new groupBy
API:
npx prisma generate
With the updated Prisma Client, you can invoke the new groupBy
query:
const locations = await client.agent.groupBy({
by: ['location'],
min: {
rate: true
},
})
// Result:
// [
// { location: "Los Angeles", min: { rate: 10.00 } },
// { location: "London", min: { rate: 20.00 } },
// { location: "Tokyo", min: { rate: 30.00 } }
// ]
Prisma also supports the having
side of group by, so you can further filter your groups:
const locations = await client.agent.groupBy({
by: ['location', 'rate'],
min: {
rate: true
},
having: {
rate: {
gte: 20
}
}
})
// Result:
// [
// { location: "London", rate: 20.00, min: { rate: 20.00 } },
// { location: "Tokyo", rate: 30.00, min: { rate: 30.00 } }
// ]
Read more in the documentation.
Linux ARM64 support
Good news for Linux users! Prisma now supports Linux ARM64 out of the box. If you already generate the Prisma Client on a Linux ARM box, it will just work. To target the specific binary, you can add a binaryTarget
to the generator
block in your Prisma schema:
generator client {
provider = "prisma-client-js"
binaryTargets = ["linux-arm-openssl-1.1.x"]
}
Learn more in the documentation.
Prisma Migrate fix for PostGIS users
PostgreSQL users who are using the PostGIS extension can now use Prisma Migrate as well.
Breaking changes
This release introduces a breaking change for TypeScript users. Prisma Client now requires TypeScript v4.1 or above. You can read more about upgrading your TypeScript version on their wiki.
Fixes and improvements
prisma
- Support number is an input for BigInt fields
- Deploying to Heroku does not generate Prisma Client by default
- Create fail with multiple connectOrCreate and connect
- Sequential $transaction with $executeRaw
- Transaction items run outside Postgres transaction (breaks) with random order
- Add more jsdoc to Prisma Client
- Rename findOne in dmmf.schema.outputObjectTypes.prisma Query
- Errors with setting foreigns keys directly
- multiple identical compound unique fields with different types not generating multiple types
- The target table of the DML statement cannot have any enabled triggers if the statement contains an OUTPUT clause without INTO clause.
- Prisma Migrate: Error creating shadow database
- Integrate Linux ARM in TypeScript
- Reintrospection Bug on Relations
- Prisma Migrate: Omit schema name when creating enum types?
- Tearing down MSSQL schema returns "Cannot read property 'split' of null"
- prisma introspect drops some @relation custom names in existing schema
- Implement
react-prisma
prototype - unable to run migrations in an empty PostGIS db
prisma-client-js
- Group By
- Generated Github issue creation links do often not include helpful information
- PANIC: expected 0 parameters but got 1 (when running $executeRaw
...
)
migrate
language-tools
- While Prisma extension is enabled, typescript server keeps crashing on each save
- Transition open-vsx extension to Eclipse Cloud Development Tools working group
- Renaming models in schema.prisma may break whole file
studio
prisma-engines
Credits
Huge thanks to @qsona for helping!
Help shape the future of Prisma
We love open-source and are commited to building world-class database tools that make developers more productive. In addition to building open-source tools, we are currently planning a cloud offering that will improve many database workflows, especially in collaborative environments.
If you want to help us shape the future of this offering, we would much appreciate if you could fill out this short survey that represents a potential onboarding flow for that cloud offering.