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:
Fixes and improvements per Prisma 2 repository
prisma2
- Broken pris.ly links in initial schema
- ExperimentalWarning: The fs.promises API is experimental message in CLI
- Api naming issue
- generate: Error message when there are no models
- Error in migration engine - Cannot start a runtime from within a runtime.
- Change
generate --helpmessage toGenerate artifacts (e.g. Prisma Client) - Adjust Prisma tagline in CLI to
Prisma is a modern DB toolkit to query, migrate and model your database - Remove
prisma2 migrate docs - Detect if unicode character can be rendered in CLI output before printing it
undefinedinprisma2 init --helpoutput- Remove documenation about onDelete
- Error in migration engine - no current timer when using prisma2 migrate
- Introspection Error reporting does not exit on Windows
- Improve formatting of missing generator error message
- Handle errors in
prisma introspect - Small docs issue/question @createdAt attribute
- Supress downloads when custom binary via environment variable is used
- Improve error message when OpenSSL is missing
- Introspection: autoincrement not recognized on SERIAL field
- [Introspection] Different order of ENUMs when introspecting Postgres DB
- Add an example with Prisma and Apollo Server in plain GraphQL without Nexus
prisma2 initfails in Yarn Workspaces- Prisma2 dev crash : thread 'main' panicked at 'Unable to resolve scalar field'
- Error with Prisma v18.2: can't find schema.prisma
- Inconsistent type generation for default values
- Each project using Prisma (and its query engine runtime) gets its own Firewall request
prisma-client-js
- Prisma client dmmf emits enum fields as scalar type
- Wrong error message when invoking
findOnewithout args - Remove pluralization
- Document that you can not do select in include
- Usage with
pg-bouncer - Photon crashes when
setfor scalarList is not provided or it is set to[] - Improve connection error message to PostgreSQL database
- Cannot read property 'collectErrors' of null
postinstallscript of this package fails if using env var in my schema- Wrong suggestions for relations
- Name collision with identical relational property names on separate types that refer to a common type
migrate
- Typo in message after "prisma2 migrate up --experimental" command
- Unexpected error occured when running migrate up in latest alpha.
- CLI: Reorder the help output of migrate to be save, up, down (instead of save, down, up)
prisma-engine
- Expose SQLSchema RPC Call for Debugging
- Sql Introspection Connector must handle
@default(autoincrement()) - Introspection Engine: Disable verbose logging
- Implement
@mapfor relation fields that use compound references - Error wording: Use "Prisma schema" instead of hardcoded "schema.prisma"
- Error P1006: Say "query engine binary" instead of "Photon binary"
- Error message for SQLite shouldn't mention DB server
