npm @prisma/client 2.0.0-preview021

latest releases: 5.21.0-dev.3, 5.21.0-integration-itx-refactor.16, 5.21.0-integration-itx-refactor.15...
4 years ago

Today, we are issuing the twenty-first Preview release: 2.0.0-preview021 (short: preview021).

This release contains breaking changes, be sure to read the notes below before upgrading!

⚠️ If you're using Prisma together with GraphQL Nexus and nexus-prisma, check out the additional release notes of nexus-prisma: https://github.com/prisma-labs/nexus-prisma/releases/tag/0.9.0

Breaking changes

The property on the PrismaClient that exposes CRUD operations per model used to be lowercased and pluralized, the pluralization of that property is now removed.

For example, for a model User you'd access a CRUD operation via the generated prisma.users property, as in prisma.users.findMany(). As of preview021, the pluralization has been removed and the property is called after the model (but lowercased), so it would now be prisma.user.findMany().

Here are few more examples showing how the calls to your PrismaClient instance must be adjusted:

Prisma schema

model User {
  id    Int    @id @default(autoincrement())
  name  String
}

Generated Prisma Client API

const prisma = new PrismaClient()

// CRUD operations are exposed via:
- // prisma.users
+ // prisma.user

// findMany
- const users = await prisma.users.findMany()
+ const users = await prisma.user.findMany()

// findOne
- const user = await prisma.users.findOne({ where: { id: 1 }})
+ const user = await prisma.user.findOne({ where: { id: 1 }})

// create
- const user = await prisma.users.create({ data: { name: "Alice" }})
+ const user = await prisma.user.create({ data: { name: "Alice" }})

// and so on ... 

Improvements

Besides many small fixes, Prisma Client JS now uses JSDoc to bring API documentation to your fingertips as you write code in your editor:

image

Fixes and improvements per Prisma 2 repository

prisma2

prisma-client-js

migrate

prisma-engine

Don't miss a new client release

NewReleases is sending notifications on new releases.