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 thePrismaClient
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
- [Introspection] Better
introspect
success message - DigitalOcean Postgres + PGBouncer Issues
&sslcert=server-ca.pem
in PostgreSQL connection url throwError opening a TLS connection: One or more parameters passed to a function were not valid.
- Prisma generate --watch errors
- Introspect default value with backslashes causes problem when generating client
- Prisma DMMF parses comments as fields docs
- Cascade delete does not work unless relation is optional
- Special-case syntax error for multiple unnamed arguments in directive in the schema parser
- Error on table update using a mapped field in where clause
- Add renovate bot for dependencies
- Prisma Schema: Add .prisma syntax highlighting for Sublime Text
- Simple filtering for JSON
- Panic calling findOne with mapped unique key fields
- Validation issue for schemas with compound foreign keys
- [introspect] Expose database classification feature
- If a comment is the last line in a model,
prisma format
will move it out of the model - Investigate alternatives to required PgBouncer configuration
- Overwriting database connection string in
Prisma Client
does not work - PgBouncer mode
- Documentation parsed from doc comment is missing for enums
prisma-client-js
- Document
forceTransactions
/ pgBouncer - Better instructions on Query Engine panic
- Ability to use Heroku's pgbouncer
- Prisma Client failing with PgBouncer Transaction Mode
- Basic reporting capability for runtime errors in Client
- Prisma Client Beta 4 broken with Netlify
- PANIC error on upsert query
- Cannot use prisma.create() with nullable field set to null
vscode
- Trailing comments are broken to the next line when formatting
- Recognize Prisma1 schemas and tell user to install the other extension and rename file
- Allow inline comment
- Formatting moves comment from inside model to above model
- Preserve newlines / whitespaces inside models
- Extension deletes unused commented out models
- Use same versioning scheme & release cadence as Prisma itself
- prisma-fmt: add newline in the end of the file
- Triple slash comments in prisma schema file not working
- Versioning scheme
- Add badges and repo explanation to README
- VSCode extension errors when linting .prisma file
- Also output extension name / package and version on startup
- Configuring Git to handle line endings
- Remove Prisma as Icon Theme