Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(deps): update prisma driver adapters to v5.7.0 (minor) - autoclosed #4529

Closed
wants to merge 1 commit into from

Conversation

renovate[bot]
Copy link
Contributor

@renovate renovate bot commented Dec 7, 2023

Mend Renovate

This PR contains the following updates:

Package Change Age Adoption Passing Confidence
@prisma/adapter-neon (source) 5.6.0 -> 5.7.0 age adoption passing confidence
@prisma/driver-adapter-utils (source) 5.6.0 -> 5.7.0 age adoption passing confidence

Release Notes

prisma/prisma (@​prisma/adapter-neon)

v5.7.0

Compare Source

🌟 Help us spread the word about Prisma by starring the repo or posting on X (formerly Twitter) about the release.

Highlights

✨ In this release, we improved the SQL queries Prisma Client generates for you with two new Preview features, the driver adapters, and support for the database drivers we currently support. 5.7.0 will be the last release of the year. Stay tuned for the next one in January! ✨

Preview support for JOINs for relation queries for PostgreSQL and CockroachDB

We’re excited to announce Preview support for JOINs in Prisma Client when querying relations. Support for JOINs has been a long-standing feature request, and this release adds support for PostgreSQL and CockroachDB. The upcoming releases will expand support for other databases Prisma supports.

To get started using JOINs, enable the Preview feature in your Prisma schema:

// schema.prisma
generator client {
  provider        = "prisma-client-js"
  previewFeatures = ["relationJoins"]
}

Run prisma generate to regenerate Prisma Client and enable the Preview feature.

Prisma Client will use a JOIN in your query to fetch relation data for a majority of the cases.

Example queries

1-1 relation queries example

Prisma Client query

await prisma.user.findUnique({
	where: {
		id: 1
	},
	include: {
		profile: true
	}
})

SQL

SELECT
	"t1"."id",
	"t1"."name",
	"User_profile"."__prisma_data__" AS "profile"
FROM
	"public"."User" AS "t1"
	LEFT JOIN LATERAL (
		SELECT
			COALESCE(JSON_AGG("__prisma_data__"), '[]') AS "__prisma_data__"
		FROM
			(
				SELECT
					"t4"."__prisma_data__"
				FROM
					(
						SELECT
							JSON_BUILD_OBJECT(
								'id',
								"t3"."id",
								'bio',
								"t3"."bio",
								'userId',
								"t3"."userId"
							) AS "__prisma_data__"
						FROM
							(
								SELECT
									"t2".*
								FROM
									"public"."Profile" AS "t2"
								WHERE
									"t1"."id" = "t2"."userId"
							) AS "t3"
					) AS "t4"
			) AS "t5"
	) AS "User_profile" ON TRUE
WHERE "t1"."id" = $1
LIMIT $2
1-m relation queries example

Prisma Client query

await prisma.user.findUnique({
	where: {
		id: 1
	},
	include: {
		posts: true
	}
})

SQL

SELECT
	"t1"."id",
	"t1"."name",
	"User_posts"."__prisma_data__" AS "posts"
FROM
	"public"."User" AS "t1"
	LEFT JOIN LATERAL (
		SELECT
			COALESCE(JSON_AGG("__prisma_data__"), '[]') AS "__prisma_data__"
		FROM
			(
				SELECT
					"t4"."__prisma_data__"
				FROM
					(
						SELECT
							JSON_BUILD_OBJECT(
								'id',
								"t3"."id",
								'title',
								"t3"."title",
								'content',
								"t3"."content",
								'published',
								"t3"."published",
								'authorId',
								"t3"."authorId"
							) AS "__prisma_data__"
						FROM
							(
								SELECT
									"t2".*
								FROM
									"public"."Post" AS "t2"
								WHERE
									"t1"."id" = "t2"."authorId"
									/* root select */
							) AS "t3"
							/* inner select */
					) AS "t4"
					/* middle select */
			) AS "t5"
			/* outer select */
	) AS "User_posts" ON TRUE
WHERE "t1"."id" = $1
LIMIT $2
m-n relation queries example

Prisma Client query

await prisma.post.findUnique({
	where: {
		id: 1
	},
	include: {
		tags: true
	}
})

SQL

SELECT
	"t1"."id",
	"t1"."title",
	"t1"."content",
	"t1"."published",
	"t1"."authorId",
	"Post_tags_m2m"."__prisma_data__" AS "tags"
FROM
	"public"."Post" AS "t1"
	LEFT JOIN LATERAL (
		SELECT
			COALESCE(JSON_AGG("__prisma_data__"), '[]') AS "__prisma_data__"
		FROM
			(
				SELECT
					"Post_tags"."__prisma_data__"
				FROM
					"public"."_PostToTag" AS "t2"
					LEFT JOIN LATERAL (
						SELECT
							JSON_BUILD_OBJECT('id', "t4"."id", 'name', "t4"."name") AS "__prisma_data__",
							"t4"."id"
						FROM
							(
								SELECT
									"t3".*
								FROM
									"public"."Tag" AS "t3"
								WHERE
									"t2"."B" = "t3"."id"
									/* root select */
							) AS "t4"
					) AS "Post_tags" ON TRUE
				WHERE
					"t2"."A" = "t1"."id"
			) AS "Post_tags_m2m_1"
	) AS "Post_tags_m2m" ON TRUE
WHERE "t1"."id" = $1
LIMIT $2

Share your feedback and create a bug report if you encounter any issues.

Prisma’s distinct option now uses SQL queries (Preview)

From this release, Prisma Client’s distinct option now uses the native SQL DISTINCT ON for unordered queries with PostgreSQL and CockroachDB. The upcoming releases will expand support for the other databases that Prisma supports.

Prisma Client already supports querying for distinct records. However, Prisma Client took care of the post-processing for distinct records in memory.

To get started, enable the Preview feature in your Prisma schema:

// schema.prisma
generator client {
  provider        = "prisma-client-js"
  previewFeatures = ["nativeDistinct"]
}

Regenerate your Prisma Client to get started using the Preview feature.

Given the following Prisma Client query:

await prisma.user.findMany({
    distinct: ['role'],
    select: {
      role: true,
    },
})

Before 5.7.0

Previously, Prisma Client handled the post-processing to select distinct records in-memory. Therefore, the following query was generated and executed against your database:

SELECT
	"public"."User"."id",
	"public"."User"."role"::text
FROM
	"public"."User"
WHERE
	1 = 1 OFFSET $1

After 5.7.0

SELECT DISTINCT ON ("public"."User"."role")
	"public"."User"."id",
	"public"."User"."role"::text
FROM
	"public"."User"
WHERE
	1 = 1 OFFSET $1

Share your feedback and create a bug report if you encounter any issues.

Improved support for Netlify using Node.js v20

In this release, we improved Prisma support when deploying to Netlify on Node.js v20. Previously, the Prisma Client could not resolve the location of the Query Engine after deploying to Netlify when using Node.js v20. If you run into this issue, we recommend updating to Prisma v5.7.0.

We recommend giving this comment on GitHub a read if you are not yet able to upgrade Prisma, to learn how to get around the error.

Fixes and improvements
Prisma Client
Prisma
Prisma Migrate
Credits

Huge thanks to @​anuraaga, @​onichandame, @​LucianBuzzo, @​RobertCraigie, @​fqazi, @​KhooHaoYit, @​alencardc, @​Oreilles, @​christianledgard, @​skyzh, @​alula, @​AikoRamalho, @​petradonka for helping!

Company news
💼 We’re hiring!

If you're interested in joining our growing team to help empower developers to build data-intensive applications, Prisma is the place for you.

We're hiring for the following roles:

v5.6.0

Compare Source

🌟 Help us spread the word about Prisma by starring the repo or tweeting about the release. 🌟

🚀 Prisma Accelerate, our connection pool and global edge cache, is now Generally Available! Sign up to give it a try. 🚀

Highlights
Driver adapters improvements (Preview)

In version 5.4.0, we released driverAdapters into Preview. The driverAdapters feature enables Prisma Client to access your database using JavaScript or Serverless database drivers.

In this release, we fixed many bugs for the existing driver adapters. We appreciate all the community feedback that has helped us improve this feature!

PlanetScale serverless driver adapter improvements

This release also introduces a small breaking change to the @prisma/adapter-planetscale package to improve its stability and performance. The serverless driver adapter will now use a connection pool instead of a single connection from PlanetScale’s serverless driver.

In case you’re using the @prisma/adapter-planetscale, update your Prisma Client instance with the following:

-import { connect } from '@​planetscale/database'
+import { Client } from '@​planetscale/database'
import { PrismaPlanetScale } from '@​prisma/adapter-planetscale'
import { PrismaClient } from '@​prisma/client'
import { fetch as undiciFetch } from 'undici';

-const connection = connect({ url: connectionString, fetch: undiciFetch })
+const client = new Client({ url: connectionString, fetch: undiciFetch })

-const adapter = new PrismaPlanetScale(connection)
+const adapter = new PrismaPlanetScale(client)

const prisma = new PrismaClient({ adapter })

If you run into the following error: [TypeError]: PrismaPlanetScale must be initialized with an instance of Client., you can use the following snippet when defining your Prisma Client instance:

import { createRequire } from "node:module";
import { PrismaPlanetScale } from "@​prisma/adapter-planetscale";
import { fetch as undiciFetch } from 'undici';

const require = createRequire(import.meta.url);
const { Client } = require("@​planetscale/database");

const client = new Client({ url:  process.env.DATABASE_URL , fetch: undiciFetch })
const adapter = new PrismaPlanetScale(client);
Request for feedback

We encourage you to try out the driver adapters and share your feedback to help us move it to General Availability in either of the following GitHub discussions:

Refer to our docs to learn more about driver adapters.

New prisma debug command

This release introduces a new command: prisma debug. The command provides debugging information such as environment variables that Prisma Client, Prisma Migrate, Prisma CLI, and Prisma Studio use. The command is also useful when creating a bug report as the information complements the output of the prisma -v command.

You can learn more about the command in our docs.

Read replicas extension improvements

We also released version 0.3.0 of the @prisma/extension-read-replicas package that contains the following improvements:

  • A new $replica() method that explicitly enables you to use a replica for your query.

    For example, by default, the queryRaw and executeRaw methods are forwarded to the primary database, as they could try to write to the database. You can use the $replica() method with either of the *Raw methods to explicitly execute your query against a replica instead of your primary database.

  • Validation for when there’s an empty list of replicas.

  • Webpack bundling fixes

We want to thank you, our community members, for your contributions! 🙏

You can find additional information on the changes in the extension’s release. You can learn more about the extension in the announcement blog post.

Package provenance

npm has introduced provenance statements to improve supply-chain security and transparency of packages. This allows developers to verify where and how packages are built.

Starting with the 5.6.0 release, all npm packages for Prisma ORM will be published with provenance statements. If you maintain a Prisma Client extension or generator, we encourage you to enable provenance statements when publishing to npm.

Fixes and improvements
Prisma Migrate
Prisma Client
Prisma CLI
Credits

Huge thanks to @​onichandame, @​LucianBuzzo, @​RobertCraigie, @​fqazi, @​KhooHaoYit, @​alencardc, @​Oreilles, @​christianledgard, @​skyzh, @​alula, @​luxaritas, @​Nasfame, @​lukahartwig, @​steebchen, @​icanipa for helping!

Company news
Prisma Accelerate is now Generally Available

We're excited to share that Prisma Accelerate is now Generally Available. Prisma Accelerate is a global database cache that's available in over 280 locations and provides scalable connection pooling for serverless and edge applications.

Learn more in the announcement blog post. Sign up and try out Prisma Accelerate here.

💼 We’re hiring!

If you're interested in joining our growing team to help empower developers to build data-intensive applications, Prisma is the place for you.

We're hiring for an Engineering Manager: Prisma Data Platform.


Configuration

📅 Schedule: Branch creation - At any time (no schedule defined), Automerge - At any time (no schedule defined).

🚦 Automerge: Disabled by config. Please merge this manually once you are satisfied.

Rebasing: Whenever PR becomes conflicted, or you tick the rebase/retry checkbox.

🔕 Ignore: Close this PR and you won't be reminded about these updates again.


  • If you want to rebase/retry this PR, check this box

This PR has been generated by Mend Renovate. View repository job log here.

@renovate renovate bot requested a review from a team as a code owner December 7, 2023 08:45
@renovate renovate bot requested review from miguelff and Weakky and removed request for a team December 7, 2023 08:45
Copy link

adaptly-bot bot commented Dec 7, 2023

✅  @prisma/adapter-neon

No breaking changes found.

Copy link

adaptly-bot bot commented Dec 7, 2023

✅  @prisma/driver-adapter-utils

No breaking changes found.

Copy link

codspeed-hq bot commented Dec 7, 2023

CodSpeed Performance Report

Merging #4529 will not alter performance

Comparing renovate/prisma-driver-adapters (968c7ae) with main (12d71c4)

Summary

✅ 11 untouched benchmarks

@renovate renovate bot changed the title fix(deps): update prisma driver adapters to v5.7.0 (minor) fix(deps): update prisma driver adapters to v5.7.0 (minor) - autoclosed Dec 8, 2023
@renovate renovate bot closed this Dec 8, 2023
@renovate renovate bot deleted the renovate/prisma-driver-adapters branch December 8, 2023 09:04
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

0 participants