github prisma/prisma 2.0.0-beta.6

latest releases: 5.13.0, 5.12.1, 5.12.0...
pre-release3 years ago

Today, we are issuing the sixth Beta release: 2.0.0-beta.6 (short: beta.6).

More powerful raw queries with Prisma Client

Thanks to @zachasme and @Sytten, the prisma.raw command became more powerful in #2311. There are two changes we introduce for raw:

Expose sql-template-tag helpers

Prisma Client's raw mode utilizes the sql-template-tag library. In order to construct raw SQL queries programmatically, Prisma Client now exposes a few helper functions:

import { sql, empty, join, raw, PrismaClient } from '@prisma/client'

const prisma = new PrismaClient()

const rawQueryTemplateFromSqlTemplate = await prisma.raw(
  sql`
    SELECT ${join([raw('email'), raw('id'), raw('name')])}
    FROM ${raw('User')}
    ${sql`WHERE name = ${'Alice'}`}
    ${empty}
  `
)

Allowing programmatic positional parameters

Sometimes, a static template string is not enough. Then constructing a string dynamically is the right choice. For this situation, we added support for arbitrary positional parameters:

const result = await prisma.raw(
  'SELECT * FROM User WHERE id = $1 OR email = $2;',
  1,
  'e@ma.il'
)

Other improvements

  • You can now enable pgBouncer in your connection URL by adding the ?pgbouncer=true parameter (forceTransactions from the PrismaClient is now deprecated and will be removed in an upcoming release)
  • Improved handling of comments in prisma format
  • Various improvements to Prisma's VS Code extension (e.g. better error messages and debug information)

Fixes and improvements

prisma

prisma-client-js

vscode

prisma-engines

Credits

Huge thanks to @Sytten, @thankwsx, @zachasme for helping!

Don't miss a new prisma release

NewReleases is sending notifications on new releases.