tim2
07/21/2020, 3:48 PMprisma introspect
until recently ordered all fields in models alphabetically. Starting with 2.3.0 it now picks up the order from the columns in your database table and uses that same order for the fields in your models in your Prisma Schema file.
prisma cool Experimental features have been renamed to preview features
With 2.1.0
we introduced feature flags for Prisma Client, called โExperimental Featuresโ. The property in the schema has been renamed from experimentalFeatures
to previewFeatures
to better communicate what they actually are.
๐ฆ Distinct API (preview)
We introduce distinct querying capabilities to Prisma Client.
It allows you to query for distinct (unique) rows of a model.
const result = await prisma.user.findMany({
where: {},
distinct: ['name']
})
๐ Middlewares API (preview)
Inspired by Koa - Prisma Client now allows you to provide powerful async middlewares.
prisma.use(async (params, next) => {
console.log('params', params)
const before = Date.now()
const result = await next(params)
const after = Date.now()
console.log(`Query ${params.model}.${params.action} took ${after - before}ms`)
return result
})
You can learn more about all features and fixes in theย release notes, weโre looking forward to your feedback for the new version!