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

chore(deps): update prisma monorepo to v5 (major) - abandoned #2918

Closed
wants to merge 2 commits into from

Conversation

renovate[bot]
Copy link
Contributor

@renovate renovate bot commented Jul 11, 2023

Mend Renovate

This PR contains the following updates:

Package Change Age Adoption Passing Confidence
@prisma/client (source) 4.15.0 -> 5.4.2 age adoption passing confidence
@prisma/internals (source) 4.15.0 -> 5.4.2 age adoption passing confidence
@prisma/migrate (source) 4.15.0 -> 5.4.2 age adoption passing confidence
prisma (source) 4.15.0 -> 5.4.2 age adoption passing confidence

Release Notes

prisma/prisma (@​prisma/client)

v5.4.2

Compare Source

Today, we are issuing the 5.4.2 patch release.

Fix in Prisma Client

v5.4.1

Compare Source

Today, we are issuing the 5.4.1 patch release.

Fix in Prisma Client
Fix in @prisma/adapter-planetscale

v5.4.0

Compare Source

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

Highlights

Preview support for PlanetScale and Neon serverless database drivers

We’re excited to announce Preview support for the Neon and PlanetScale serverless database drivers. The PlanetScale and Neon serverless database drivers allow Prisma to connect to your database using protocols besides TCP — HTTP (PlanetScale) or WebSockets (Neon).

To get started with the serverless database drivers, first enable the driverAdapters Preview feature flag in your Prisma schema:

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

Next, to set up Prisma Client to use the serverless database drivers:

PlanetScale

Install the Prisma adapter for PlanetScale and PlanetScale serverless database driver, and undici:

npm install @​prisma/adapter-planetscale @​planetscale/database undici

Prisma ORM supports Node 16 and up. In Node 18 and up, undici is not needed.

Ensure you update the host value in your connection string to aws.connect.psdb.cloud. You can learn more about this here.

DATABASE_URL='mysql://johndoe:[email protected]/clear_nightsky?sslaccept=strict'

Update your Prisma Client instance to use the PlanetScale database driver:

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

// Initialize Prisma Client with the PlanetScale serverless database driver
const connection = connect({ url: connectionString, fetch: undiciFetch });
const adapter = new PrismaPlanetScale(connection);
const prisma = new PrismaClient({ adapter });
Neon

Install the Prisma adapter for Neon, Neon serverless database driver and undici (WebSockets):

npm install @​prisma/adapter-neon @​neondatabase/serverless undici

Update your Prisma Client instance to use the Neon serverless database driver:

// Import required dependencies
import { Pool, neonConfig } from '@​neondatabase/serverless';
import { PrismaNeon } from '@​prisma/adapter-neon';
import { PrismaClient } from '@​prisma/client';
import { WebSocket } from 'undici'

neonConfig.webSocketConstructor = WebSocket;

// Initialize Prisma Client with the Neon serverless database driver
const pool = new Pool({ connectionString: process.env.DATABASE_URL });
const adapter = new PrismaNeon(pool);
const prisma = new PrismaClient({ adapter });

Let us know your feedback about the Neon or Planetscale serverless database drivers in the linked GitHub discussions. Create a bug report if you run into any issues.

Early Access support for Turso

Turso is an edge-hosted, distributed database that's based on libSQL, an open-source and open-contribution fork of SQLite, enabling you to bring data closer to your application and minimize query latency.

Since support for Turso is in Early Access, there may be some rough edges which we’re still working on it to improve the API and overall support. Additionally, it is behind the driverAdapters Preview feature flag. Enable it to get started using Turso in your project:

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

Next, install the Prisma Client adapter for Turso and the libSQL database client

npm install @​prisma/adapter-libsql @​libsql/client

Update your Prisma Client instance:

// Import required dependencies
import { PrismaClient } from '@​prisma/client'
import { PrismaLibSQL } from '@​prisma/adapter-libsql'
import { createClient } from '@​libsql/client'

// Create a new instance of the libSQL database client
const libsql = createClient({
  // @​ts-expect-error
  url: process.env.TURSO_DATABASE_URL,
  authToken: process.env.TURSO_AUTH_TOKEN 
})

// Create a Prisma "adapter" for libSQL
const adapter = new PrismaLibSQL(libsql)
// Pass the adapter option to the Prisma Client instance
const prisma = new PrismaClient({ adapter })

You can learn more on how to use Prisma together with Turso in the announcement blog post.

Try it out! Let us know what you think and create a bug report if you run into any issues.

Query performance improvements

In our continued efforts to make Prisma Client faster, we identified and improved the performance of different types of queries.

Relation filters improvements

We made the following improvements to relation filters:

  • Removed an unnecessary INNER JOIN used in relation filter queries (Big thank you to @​KhooHaoYit for helping out)
  • Use of LEFT JOIN's for to-one relations. Previously, Prisma made use of sub-queries to fetch data.

Example Prisma Client query

prisma.comment.findMany({
  where: {
    post: {
      author: {
        name: "John"
      }
    }
  }
})

Before 5.4.0

SELECT
  "Comment"."id"
FROM
  "Comment"
WHERE
  ("Comment"."id") IN (
    SELECT
      "t0"."id"
    FROM
      "Comment" AS "t0"
      INNER JOIN "Post" AS "j0" ON ("j0"."id") = ("t0"."postId")
    WHERE
      (
        ("j0"."id") IN (
          SELECT
            "t1"."id"
          FROM
            "Post" AS "t1"
            INNER JOIN "User" AS "j1" ON ("j1"."id") = ("t1"."userId")
          WHERE
            (
              "j1"."name" = $ 1
              AND "t1"."id" IS NOT NULL
            )
        )
        AND "t0"."id" IS NOT NULL
      )
  );

After 5.4.0

SELECT
  "Comment"."id"
FROM
  "Comment"
  LEFT JOIN "Post" AS "j1" ON ("j1"."id") = ("Comment"."postId")
  LEFT JOIN "User" AS "j2" ON ("j2"."id") = ("j1"."userId")
WHERE
  (
    "j2"."name" = $ 1
    AND ("j2"."id" IS NOT NULL)
    AND ("j1"."id" IS NOT NULL)
  );

If you’re interested in more details on the relation query filter improvements, you can take a look at this pull request.

Enum improvements on PostgreSQL and CockroachDB

Previously, when an enum value was used in a query, our Postgres driver would make additional queries to resolve the enum types that were used.

In this release, we’re making improvements by casting enums to TEXT to avoid the additional roundtrips when resolving the types.

This change should have the most impact if you’re using pgBouncer or if you’re running Prisma in a serverless environment, where our Postgres driver can’t cache enum types information.

Prisma schema

model User {
  id   Int  @​id @​default(cuid())
  role Role
}

enum Role {
  User
  Admin
}

Prisma Client query

await prisma.user.findMany({ 
  where: {
    role: "Admin"
  }
})

Before 5.4.0

-- Internal driver query
SELECT t.typname, t.typtype, t.typelem, r.rngsubtype, t.typbasetype, n.nspname, t.typrelid FROM pg_catalog.pg_type t LEFT OUTER JOIN pg_catalog.pg_range r ON r.rngtypid = t.oid INNER JOIN pg_catalog.pg_namespace n ON t.typnamespace = n.oid WHERE t.oid = $1;

-- Internal driver query
SELECT enumlabel FROM pg_catalog.pg_enum WHERE enumtypid = $1 ORDER BY enumsortorder;

-- Prisma Client query
SELECT id, role FROM "User" WHERE role = $1;

After 5.4.0

-- Prisma Client query
SELECT id, role::text FROM "User" WHERE role = CAST($1::text AS "Role);
Bulk delete improvements

We optimized the deleteMany operation by:

  • Removing all SELECT queries used to fetch data that would be used as input for the DELETE operation. In some cases, this also improves index usage.
  • Removing the transaction previously used as it’s now a single atomic operation.

Prisma Client query

await prisma.post.deleteMany({
  where: {
    id: {
      gt: 1,
      lt: 10,
    }
  }
})

Before 5.4.0

BEGIN
SELECT id FROM "Post" WHERE id > 1 AND id < 10;
SELECT id FROM "Post" WHERE id > 1 AND id < 10 AND id IN (<...select ids>);
DELETE FROM "Post" WHERE id IN (<...select ids>) AND id > 1 AND id < 10;
COMMIT

After 5.4.0

DELETE FROM "Post" WHERE id > 1 AND id < 10;
Upsert improvements

We improved the upsert operation (non-native database upsert) by removing a redundant SELECT query:

Prisma Client query

await prisma.user.upsert({
  where: { email: "[email protected]" },
  create: { email: "[email protected]", firstName: "John" },
  update: { firstName: "Johnny" },
})

Before 5.4.0

SELECT `User`.`id` FROM `User` WHERE `User`.`email` = ?;
SELECT `User`.`id` FROM `User` WHERE `User`.`email` = ?;
UPDATE `prisma`.`User` SET `firstName` = ? WHERE `prisma`.`User`.`id` IN (?) AND `prisma`.`User`.`email` = ?;
SELECT `User`.`id` FROM `User` WHERE `User`.`id` = ?;

After 5.4.0

SELECT `User`.`id` FROM `User` WHERE `User`.`email` = ?;
UPDATE `prisma`.`User` SET `firstName` = ? WHERE `prisma`.`User`.`id` IN (?) AND `prisma`.`User`.`email` = ?;
SELECT `User`.`id` FROM `User` WHERE `User`.`id` = ?;

Fixes and improvements

Prisma Client
Language tools (e.g. VS Code)
Prisma Engines

Credits

Huge thanks to @​onichandame, @​fqazi, @​KhooHaoYit, @​alencardc, @​Oreilles, @​christianledgard, @​skyzh, @​alula, @​michaelpoellath, @​RobertCraigie, @​icanipa, @​jiashengguo, @​stephenwade, @​darthmaim, @​ludralph, @​Gerschtli, @​andyjy for helping!

💼 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 currently hiring for the following roles:

Feel free to read the job descriptions and apply using the links provided.

v5.3.1

Compare Source

Today, we are issuing the 5.3.1 patch release.

Fix in Prisma Client

v5.3.0

Compare Source

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

Highlights

In this sprint, we’ve made bug fixes and overall improvements to Prisma Client. We’ve been working on a few projects that will be announced soon. Stay tuned for the upcoming releases for updates!

Improvements and bug fixes

We made the following changes:

Prisma Client improvements
  • Validation for undefined values in arrays in Json fields
    We added runtime validation for undefined values in arrays in Json fields. Prisma Client will now return an error when an array contains an undefined value. Therefore, we encourage you to add validation that either removes the value or transforms it to null if you stumble on the runtime validation:
// Query
await prisma.user.findMany({
 where: {
   // JSON field
   preferences: [undefined, '"theme": "dark"', null, ]
 }
})

// Example error message on running the query
Can not use `undefined` value within array. Use `null` or filter out `undefined` values
  • Performance improvements for models with many unique fields

This release improves Prisma Client’s memory consumption for models with many @unique constraints. This was a regression from version 4.10.1, where in some cases, if a model had many unique constraints, Prisma Client would use up a lot of available memory.

  • Fixed the segmentation fault error that used to occur on ARM64 Linux binary targets
  • Metrics Preview feature improvements:
    • We updated the counters and gauge properties
    • We fixed the bug that caused the prisma_pool_connections_open metric to have a negative value in some cases.
Prisma Migrate improvements
  • Fixed an introspection bug for MongoDB views. Previously, if a MongoDB database contained a view, prisma db pull would throw an error. We resolved this, and views are now ignored.
  • Added the PRISMA_SCHEMA_DISABLE_ADVISORY_LOCK environment variable that enables you to disable advisory locking.
VS Code extension improvements
  • Added support for rendering multi-line comments in tooltips when hovering on a block.
  • Improved the auto-completion for composite types in other blocks.
  • Added a Code Action that allows you to replace SetDefault with NoAction when using MySQL and the default/foreignKeys relation mode.

Fixes and improvements

Prisma Migrate
Prisma Client
Language tools (e.g. VS Code)

Credits

Huge thanks to @​alencardc, @​Oreilles, @​christianledgard, @​skyzh, @​alula, @​michaelpoellath, @​RobertCraigie, @​stephenwade for helping!

v5.2.0

Compare Source

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

Highlights

Improved Prisma Client experience for Prisma Accelerate and Data Proxy

In this release, we’ve made the following improvements to Prisma Client when using Prisma Accelerate or Prisma Data Proxy:

  • Prisma Client will now automatically determine how it should connect to the database depending on the protocol in the connection string. If the connection string starts with prisma://, Prisma Client will try to connect to your database using Prisma Accelerate or Prisma Data Proxy.

  • Prisma Studio now works with Prisma Data Proxy and Prisma Accelerate.

  • We’ve introduced a new --no-engine flag which will prevent a Query Engine file from being included in the generated Prisma Client. This flag will also help ensure the bundle size of your application remains small by excluding the Query Engine files from the generated Prisma Client.

    prisma generate --no-engine

    The --data-proxy and --accelerate flags have not been removed but are now aliases for the new --no-engine flag.

    We recommend using the --no-engine flag when generating Prisma Client that uses either Accelerate or Data Proxy.

Simplified connection string override in Prisma Client

This release simplifies the API used when programmatically overriding the connection string by introducing the datasourceUrl property in Prisma Client’s constructor. This means you do not have to use the datasource name defined in your Prisma schema.

const prisma = new PrismaClient({
  datasourceUrl: "postgresql://johndoe:randompassword@localhost:5432/mydb",
})

Query performance improvements

Continuing our work from 5.1.0 we made further performance improvements around the queries Prisma executes, targeting one-to-many relation fields and nested updates.

Use LIMIT in one-to-many relations on a single parent

In cases where there is a single parent with a one-to-many relation included (findFirst, findUnique, findMany({ take: 1 })), we now utilize LIMIT at the database level to restrict the number of related items returned instead of retrieving all related items into memory and performing a take in memory.

For situations where you have many related objects but only need a few, you should see a dramatic improvement in speed and memory usage.

Note: we are still working on bringing this improvement to other parts of Prisma Client in upcoming releases. If multiple parent records are returned, the previous behavior is used.

Further improvements for nested writes

Thanks to our introduction of using RETURNING in some cases in 5.1.0, we could now improve performance in nested writes by removing reload nodes. This will now result in one less query per relation traversed in a nested write. For more info, check out the pull request.

Prisma Client query
await prisma.post.update({
  where: { id: 1 },
  data: {
    comment: {
      update: { 
        data: {
          body: "Updated comment body"
        }
      }
    }
  },
  select: {
    id: true,
    title: true,
  }
})
Before v5.2.0
SELECT "Post"."id", "Post"."title" FROM "Post" WHERE ("Post"."id" = $1 AND 1=1) LIMIT $2 OFFSET $3
SELECT "Post"."id", "Post"."userId" FROM "Post" WHERE "Post"."id" = $1 OFFSET $2
SELECT "User"."id" FROM "User" WHERE (1=1 AND "User"."id" IN ($1)) OFFSET $2
SELECT "User"."id" FROM "User" WHERE ("User"."id" = $1 AND 1=1) LIMIT $2 OFFSET $3
SELECT "User"."id", "User"."commentId" FROM "User" WHERE "User"."id" = $1 OFFSET $2
SELECT "Comment"."id" FROM "Comment" WHERE (1=1 AND "Comment"."id" IN ($1)) OFFSET $2
UPDATE "Comment" SET "body" = $1 WHERE ("Comment"."id" = $2 AND 1=1) RETURNING "Comment"."id"
SELECT "Post"."id", "Post"."title" FROM "Post" WHERE "Post"."id" = $1 LIMIT $2 OFFSET $3
5.2.0 and later
SELECT "Post"."id", "Post"."title", "Post"."userId" FROM "Post" WHERE ("Post"."id" = $1 AND 1=1) LIMIT $2 OFFSET $3
SELECT "User"."id" FROM "User" WHERE (1=1 AND "User"."id" IN ($1)) OFFSET $2
SELECT "User"."id", "User"."commentId" FROM "User" WHERE ("User"."id" = $1 AND 1=1) LIMIT $2 OFFSET $3
SELECT "Comment"."id" FROM "Comment" WHERE (1=1 AND "Comment"."id" IN ($1)) OFFSET $2
UPDATE "Comment" SET "body" = $1 WHERE ("Comment"."id" = $2 AND 1=1) RETURNING "Comment"."id"
SELECT "Post"."id", "Post"."title" FROM "Post" WHERE "Post"."id" = $1 LIMIT $2 OFFSET $3

Fixes and improvements

Prisma Client
Prisma Migrate

Credits

Huge thanks to @​skyzh, @​alula, @​michaelpoellath, @​RobertCraigie, @​darthmaim, @​Gerschtli, @​andyjy, @​mejiaej, @​iurylippo, @​mrazauskas, @​coder246, @​RDIL for helping!

v5.1.1

Compare Source

Today, we are issuing the 5.1.1 patch release.

Fixes in Prisma Client

v5.1.0

Compare Source

Today, we are excited to share the 5.1.0 stable release 🎉

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

Highlights

After two big releases where we released Client extensions for production usage (4.16.0) and made Prisma faster by default (5.0.0), we have focused on some smaller issues to make the experience with these new features even better.

Community contributions

Our community has been on the roll! We appreciate everyone who helps us by opening a GitHub issue or proposing a fix via Pull Requests. In this release, we're excited to highlight multiple community contributions:

Better performance: Fewer SQL queries on PostgreSQL & CockroachDB

In our continued and ongoing work to make Prisma faster, we identified some Prisma Client queries that led to multiple SQL statements being executed — although in specific databases, that was not necessary.

Hence we optimized our internal SQL generation for PostgreSQL and CockroachDB to generate more efficient SQL queries:

Simple create query

In a simple create query, RETURNING makes the second query and the transaction statements obsolete:

Prisma Client query
prisma.user.create({ 
  data: { name: "Original name" } 
})
Before v5.1.0
BEGIN
INSERT INTO "User" ("name") VALUES ($1) RETURNING "User"."id"
SELECT "User"."id", "User"."name" FROM "User" WHERE "User"."id" = $1;
COMMIT
5.1.0 and later
-- Sends 1 statement (instead of 2) and omits the transaction
INSERT INTO "User" ("name") VALUES ($1) RETURNING "User"."id", "User"."name"
Simple update query

For a simple update query, RETURNING makes both additional queries and the transaction statements obsolete:

Prisma Client query
prisma.user.update({ 
  where: { id: 1 }, 
  data: { name: "updated" } 
})
Before v5.1.0
BEGIN
SELECT id FROM "User" WHERE "User".id = 1;
UPDATE "User" SET name = 'updated' WHERE "User".id = 1;
SELECT id, name FROM "User" WHERE "User".id = 1;
COMMIT
5.1.0 and later
-- Sends 1 statement (instead of 3) and omits the transaction
UPDATE "User" SET name = 'updated' WHERE "User".id = 1 RETURNING "User".id, "User".name;
Simple update query, return with relation value

One SELECT query could easily be dropped in a simple update query that should return a relation value as well:

Prisma Client query
prisma.user.update({ 
  where: { id: 1 }, 
  data: { name: "updated" }, 
  includes: { posts: true }  
})
Before v5.1.0
BEGIN
SELECT id FROM "User" WHERE "User".id = 1;
UPDATE "User" SET name = 'updated' WHERE "User".id = 1;
SELECT id, name FROM "User" WHERE "User".id = 1;
SELECT id, title FROM "Post" WHERE "Post"."userId" = 1;
COMMIT
5.1.0 and later
-- Sends 3 statements (instead of 4)
BEGIN
UPDATE "User" SET name = 'updated' WHERE "User".id = 1 RETURNING "User".id;
SELECT id, name FROM "User" WHERE "User".id = 1;
SELECT id, title FROM "Post" WHERE "Post"."userId" = 1;
COMMIT
Empty update query

An empty update query can be optimized to skip the transaction and the second identical query by creating specific handling for this edge case in our code:

Prisma Client query
prisma.user.update({ 
  where: { id: 1 }, 
  data: {}, 
})
Before v5.1.0
BEGIN
SELECT id, name FROM "User" WHERE "User".id = 1;
SELECT id, name FROM "User" WHERE "User".id = 1;
COMMIT
5.1.0 and later
-- Sends 1 statement (instead of 2) and omits the transaction
SELECT id, name FROM "User" WHERE "User".id = 1;
Simple + relation update query (but do not return relation value)

An update of both the model and its relation, we could drop 2 SELECT queries that we did before without ever using their return values:

Prisma Client query
prisma.user.update({ 
  where: { id: 1 }, 
  data: {
    name: "updated",
    posts: {
      update: {
        where: { id: 1 },
        data: {
          title: "updated"
        }
      }
    }
  }
})
Before v5.1.0
BEGIN
SELECT id, name FROM "User" WHERE "User".id = 1;
UPDATE "User" SET name = 'updated' WHERE "User".id = 1 RETURNING "User".id;
SELECT "id", "postId" FROM "Post" WHERE "Post".id = 1;
UPDATE "Post" SET title = 'updated' WHERE "Post"."userId" = 1 AND "Post".id = 1;
SELECT id, name FROM "User" WHERE "User".id = 1;
COMMIT
5.1.0 and later
-- Sends 3 statements (instead of 5) 
BEGIN
UPDATE "User" SET name = 'updated' WHERE "User".id = 1 RETURNING "User".id, "User".name;
SELECT "id", "postId" FROM "Post" WHERE "Post".id = 1;
UPDATE "Post" SET title = 'updated' WHERE "Post"."userId" = 1 AND "Post".id = 1;
COMMIT

In the next releases, we will continue optimizing Prisma Client queries to only run the minimal amount of SQL queries necessary.

If you notice any Prisma Client queries that are affected right now, please check the issues under our performance/queries label. If you didn’t find one for what you’re seeing, please create a new issue. This will be super useful for us to understand all (edge) cases. Thank you!

Prisma Studio now supports directUrl

Our CLI command prisma studio that opens Prisma Studio now also can use the directUrl property of the datasource block so you can make it talk to a different database than defined in url. This makes it easier to use Studio alongside the Prisma Data Proxy and Accelerate.

Prisma Client: No more type clashes

We fixed (almost) all cases where using a specific term as a model name in your Prisma Schema would lead to a type clash due to Prisma’s generated typings. As a result of a type clash, it was not possible to use that model in your code (this was e.g. the case if you named a model Model or ModelUpdate).

We also deprecated the <ModelName>Args type as part of that fix. Going forward, <ModelName>DefaultArgs should be used instead.

Fixes and improvements

Prisma Client
Prisma Studio
Language tools (e.g. VS Code)

Credits

Huge thanks to @​skyzh, @​alula, @​michaelpoellath, @​RobertCraigie, @​Gerschtli, @​andyjy, @​mejiaej, @​iurylippo, @​mrazauskas for helping!

v5.0.0

Compare Source

We’re excited to share the 5.0.0 release today 🎉

Prisma 5.0.0 contains a lot of changes that improve Prisma’s performance, especially in serverless environments. If you want to learn more about the performance improvements, we wrote a blog post that sums up all the changes we made: Prisma 5: Faster by Default.

As this is a major release, it includes a few breaking changes that might affect a small group of our users. Before upgrading, we recommend that you check out our upgrade guide to understand the impact on your application.

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

Highlights

Here’s a summary of the changes:

  • Preview features moved to General Availability
    • jsonProtocol: improves communication between Prisma Client and the query engine, makes Prisma faster by default.
    • fieldReference: adds support for comparing columns of the same table.
    • extendedWhereUnique: adds support for non-unique columns inside where clauses for queries that operate on unique records.
  • General improvements and breaking changes
    • Dependency version changes
      • Minimum Node.js version change to 16.13.0
      • Minimum TypeScript version change to 4.7
      • Minimum PostgreSQL version change to 9.6
      • Prisma Client embedded SQLite version upgrade to 3.41.2
    • Main Changes
      • Removal of rejectOnNotFound property
      • Removal of some array shortcuts
      • cockroachdb provider is now required when connecting to a CockroachDB database
      • Removed runtime/index.js from the generated Prisma Client
    • Other Changes
      • Removal of deprecated flags in the Prisma CLI
      • Removal of the beforeExit hook from the library engine
      • Removal of deprecated prisma2 executable
      • Removal of deprecated experimentalFeatures generator property in the Prisma schema
      • Renamed migration-engine to schema-engine

A JSON-based protocol that improves Prisma’s performance

We’re thrilled to announce that the jsonProtocol Preview feature is now Generally Available. You can now remove the Preview feature flag from your schema after upgrading. We made the JSON-based wire protocol the default protocol used for communication between Prisma Client and the query engine.

We introduced this feature in version 4.11.0 to improve Prisma’s performance. Previously, Prisma used a GraphQL-like protocol to communicate between Prisma Client and the query engine. Applications with larger schemas had higher CPU and memory consumption compared to smaller schemas which created a performance bottleneck.

The JSON-based wire protocol improves efficiency when Prisma Client is communicating with the query engine.

Removal of array shortcuts

We took the opportunity to remove some array shortcuts to make our typings more consistent and logical. These shortcuts were a way to add a single element as a value to an array-based operator instead of wrapping a single element in an array. We will now require array values for the following:

  • OR operator shortcuts
  • in and notIn operator shortcuts
  • PostgreSQL JSON path field shortcut
  • Scalar list shortcuts
  • MongoDB Composite types list shortcuts

Here’s an example query using the OR operator shortcut for a single element;

await prisma.user.findMany({
  where: {
-    OR: { email: '[email protected]' }
+    OR: [{ email: '[email protected]' }]
  }
})

We recommend taking a look at the upgrade guide to learn how you can update your queries to work in Prisma 5.

Support for comparing multiple columns

We’re excited to announce that the fieldReference Preview feature is now stable and Generally Available. This means you can use this feature without the Preview feature flag in your Prisma schema.

We first introduced this feature in 4.5.0 to add the ability to compare columns on the same table. For example, the following query returns records where the quantity value is less than the warnQuantity of a product:

await prisma.product.findMany({
  where: { 
		quantity: { lte: prisma.product.fields.warnQuantity } 
	},
})

To learn more about this feature, refer to our documentation.

Support for filtering non-unique columns in queries for a unique record

We’re excited to announce the extendedWhereUnique Preview feature is now Generally Available. This means you can use the feature without the Preview feature flag in the Prisma schema.

We first introduced this feature in version 4.5.0 to add support for non-unique columns inside where clauses for queries that operate on unique records, such as findUnique, update, and delete, which was previously not possible.

For example, consider the following model:

model Article {
  id      Int    @&#8203;id @&#8203;default(autoincrement())
  content String
  version Int
}

You can filter on non-unique columns such as the version field as follows:

await prisma.article.findUnique({
  where: { 
    id: 5, 
    version: 1 // filter on the `version` field was not available before Prisma 4.5.0
  },
});

To learn more about this feature, refer to our documentation.

Minimum Node.js version change to 16.13.0

The minimum version of Node.js Prisma supports is 16.13.0. If you're using an earlier version of Node.js, you will need to upgrade your Node.js version.

Refer to our system requirements for the minimum versions Prisma requires.

Minimum TypeScript version change to 4.7

The minimum version of TypeScript Prisma supports is 4.7. If your project is using an earlier version of TypeScript, you will need to upgrade your TypeScript version.

Refer to our system requirements for the minimum versions Prisma requires.

Minimum PostgreSQL version change to 9.6

The minimum version of PostgreSQL Prisma supports is version 9.6. If you’re either using 9.4 or 9.5, you will need to update your PostgreSQL version to at least 9.6.

Refer to our system requirements for the minimum database versions Prisma requires.

Prisma Client embedded SQLite version upgrade

We upgraded the embedded version of SQLite from 3.35.4 to 3.41.2. We do not anticipate any breaking changes or changes needed in projects using SQLite. However, if you’re using SQLite, especially with raw queries that might go beyond Prisma's functionality, make sure to check the SQLite changelog.

Removal of rejectOnNotFound property

In version 5.0.0, we removed the rejectOnNotFound parameter from Prisma Client that was deprecated in version 4.0.0. We removed this feature to provide better type-safety using the findUniqueOrThrow and findFirstOrThrow methods as well have a consistent API.

If you are using the rejectOnNotFound parameter we recommend either:

  • Replacing your queries with the findFirstOrThrow or findUniqueOrThrow methods if enabled at a query-level
  • Using a Prisma Client extension to overload the findFirstOrThrow and findUniqueOrThrow model methods with your custom error handling if enabled at the client-level

We recommend taking a look at the upgrade guide for more information on how to adapt your application if you’re using rejectOnNotFound.

cockroachdb provider is now required when connecting to a CockroachDB database

Prior to adding explicit support for CockroachDB with the cockroachdb provider in 3.9.0, it was possible to use the PostgreSQL provider when working with CockroachDB databases.

We’re now making it mandatory to use the CockroachDB connector when working with CockroachDB databases. CockroachDB and PostgreSQL have a few differences such as the available native types which impact the generated migrations.

If you were using the PostgreSQL connector to work with CockroachDB, take a look at the upgrade guide to learn how you can update your connector.

Removal of the generated runtime/index.js file from Prisma Client

With Prisma 5, we removed the runtime/index.js file from Prisma Client. If you were using APIs from runtime/index.js, such as Decimal , PrismaClientKnownRequestError,  NotFoundError,  PrismaClientUnknownRequestError, we recommend updating your imports:

- import { Decimal } from '@&#8203;prisma/client/runtime'
+ import { Prisma } from '@&#8203;prisma/client'

// Usage update of Prisma Client's utilities
- Decimal
+ Prisma.Decimal

We recommend taking a look at the upgrade guide to learn how you can migrate to Prisma 5

Removal of the beforeExit hook from the library query engine

We removed


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 added the dependencies Pull requests that update a dependency file label Jul 11, 2023
@changeset-bot
Copy link

changeset-bot bot commented Jul 11, 2023

⚠️ No Changeset found

Latest commit: 29b3ab6

Merging this PR will not cause a version bump for any packages. If these changes should not result in a new version, you're good to go. If these changes should result in a version bump, you need to add a changeset.

This PR includes no changesets

When changesets are added to this PR, you'll see the packages that this PR includes changesets for and the associated semver types

Click here to learn what changesets are, and how to add one.

Click here if you're a maintainer who wants to add a changeset to this PR

@github-actions
Copy link
Contributor

github-actions bot commented Jul 11, 2023

Apollo Federation Subgraph Compatibility Results

Federation 1 SupportFederation 2 Support
_service🟢
@key (single)🟢
@key (multi)🟢
@key (composite)🟢
repeatable @key🟢
@requires🟢
@provides🟢
federated tracing🟢
@link🟢
@shareable🟢
@tag🟢
@override🟢
@inaccessible🟢
@composeDirective🟢
@interfaceObject🟢

Learn more:

@github-actions
Copy link
Contributor

github-actions bot commented Jul 11, 2023

✅ Benchmark Results

     ✓ no_errors{mode:graphql}
     ✓ expected_result{mode:graphql}
     ✓ no_errors{mode:graphql-jit}
     ✓ expected_result{mode:graphql-jit}
     ✓ no_errors{mode:graphql-response-cache}
     ✓ expected_result{mode:graphql-response-cache}
     ✓ no_errors{mode:graphql-no-parse-validate-cache}
     ✓ expected_result{mode:graphql-no-parse-validate-cache}

     checks.......................................: 100.00% ✓ 268244      ✗ 0     
     data_received................................: 1.1 GB  9.0 MB/s
     data_sent....................................: 54 MB   451 kB/s
     http_req_blocked.............................: avg=2.04µs   min=1.2µs   med=1.8µs    max=621.21µs p(90)=2.5µs    p(95)=2.8µs   
     http_req_connecting..........................: avg=4ns      min=0s      med=0s       max=156.2µs  p(90)=0s       p(95)=0s      
     http_req_duration............................: avg=582.59µs min=276.7µs med=481.3µs  max=28.67ms  p(90)=865.81µs p(95)=909.11µs
       { expected_response:true }.................: avg=582.59µs min=276.7µs med=481.3µs  max=28.67ms  p(90)=865.81µs p(95)=909.11µs
     ✓ { mode:graphql-jit }.......................: avg=422.23µs min=276.7µs med=375.5µs  max=21.15ms  p(90)=441µs    p(95)=487.7µs 
     ✓ { mode:graphql-no-parse-validate-cache }...: avg=941.71µs min=754.4µs med=862.51µs max=28.67ms  p(90)=954.59µs p(95)=1.08ms  
     ✓ { mode:graphql-response-cache }............: avg=516.62µs min=367µs   med=470.8µs  max=11.59ms  p(90)=530µs    p(95)=565.9µs 
     ✓ { mode:graphql }...........................: avg=592.29µs min=374.2µs med=512.51µs max=23.98ms  p(90)=615.61µs p(95)=730.81µs
     http_req_failed..............................: 0.00%   ✓ 0           ✗ 134122
     http_req_receiving...........................: avg=36.04µs  min=18.89µs med=31.3µs   max=8.13ms   p(90)=47µs     p(95)=50.6µs  
     http_req_sending.............................: avg=16.01µs  min=7µs     med=10.3µs   max=3.69ms   p(90)=16.89µs  p(95)=20.9µs  
     http_req_tls_handshaking.....................: avg=0s       min=0s      med=0s       max=0s       p(90)=0s       p(95)=0s      
     http_req_waiting.............................: avg=530.53µs min=246.1µs med=434.6µs  max=28.56ms  p(90)=820.61µs p(95)=853.21µs
     http_reqs....................................: 134122  1117.655423/s
     iteration_duration...........................: avg=887.43µs min=508.7µs med=778.41µs max=29.1ms   p(90)=1.15ms   p(95)=1.23ms  
     iterations...................................: 134122  1117.655423/s
     vus..........................................: 1       min=0         max=2   
     vus_max......................................: 2       min=2         max=2   

@github-actions
Copy link
Contributor

github-actions bot commented Jul 11, 2023

💻 Website Preview

The latest changes are available as preview in: https://a7c9cd0e.graphql-yoga.pages.dev

@renovate renovate bot force-pushed the renovate/major-prisma-monorepo branch from 568bae3 to d7f1bf7 Compare July 13, 2023 15:39
@renovate renovate bot force-pushed the renovate/major-prisma-monorepo branch 2 times, most recently from 683e2ed to 91355ab Compare July 25, 2023 01:37
@renovate renovate bot force-pushed the renovate/major-prisma-monorepo branch 5 times, most recently from 9c23b1f to 252e961 Compare August 7, 2023 00:26
@renovate renovate bot force-pushed the renovate/major-prisma-monorepo branch 2 times, most recently from 1e1e054 to e83518e Compare August 22, 2023 13:29
@renovate renovate bot force-pushed the renovate/major-prisma-monorepo branch 3 times, most recently from 69f1df9 to 1a5f520 Compare August 24, 2023 21:18
@renovate renovate bot force-pushed the renovate/major-prisma-monorepo branch from 1a5f520 to a5d76a9 Compare September 13, 2023 10:51
@github-actions
Copy link
Contributor

github-actions bot commented Sep 13, 2023

🚀 Snapshot Release (rc)

The latest changes of this PR are available as rc on npm (based on the declared changesets):

Package Version Info
graphql-yoga-cloud-run-guide 2.0.5-rc-20230928134710-13f48a72 npm ↗︎ unpkg ↗︎
@graphql-yoga/apollo-link 2.0.5-rc-20230928134710-13f48a72 npm ↗︎ unpkg ↗︎
@graphql-yoga/urql-exchange 2.0.5-rc-20230928134710-13f48a72 npm ↗︎ unpkg ↗︎
graphql-yoga 4.0.5-rc-20230928134710-13f48a72 npm ↗︎ unpkg ↗︎
@graphql-yoga/nestjs 2.1.1-rc-20230928134710-13f48a72 npm ↗︎ unpkg ↗︎
@graphql-yoga/nestjs-federation 2.2.1-rc-20230928134710-13f48a72 npm ↗︎ unpkg ↗︎
@graphql-yoga/plugin-apollo-inline-trace 2.0.5-rc-20230928134710-13f48a72 npm ↗︎ unpkg ↗︎
@graphql-yoga/plugin-apq 2.0.5-rc-20230928134710-13f48a72 npm ↗︎ unpkg ↗︎
@graphql-yoga/plugin-csrf-prevention 2.0.5-rc-20230928134710-13f48a72 npm ↗︎ unpkg ↗︎
@graphql-yoga/plugin-defer-stream 2.0.5-rc-20230928134710-13f48a72 npm ↗︎ unpkg ↗︎
@graphql-yoga/plugin-disable-introspection 1.0.5-rc-20230928134710-13f48a72 npm ↗︎ unpkg ↗︎
@graphql-yoga/plugin-graphql-sse 2.0.5-rc-20230928134710-13f48a72 npm ↗︎ unpkg ↗︎
@graphql-yoga/plugin-jwt 1.0.2-rc-20230928134710-13f48a72 npm ↗︎ unpkg ↗︎
@graphql-yoga/plugin-persisted-operations 2.0.5-rc-20230928134710-13f48a72 npm ↗︎ unpkg ↗︎
@graphql-yoga/plugin-prometheus 2.0.6-rc-20230928134710-13f48a72 npm ↗︎ unpkg ↗︎
@graphql-yoga/plugin-response-cache 2.2.0-rc-20230928134710-13f48a72 npm ↗︎ unpkg ↗︎
@graphql-yoga/plugin-sofa 2.0.5-rc-20230928134710-13f48a72 npm ↗︎ unpkg ↗︎
@graphql-yoga/render-graphiql 4.0.5-rc-20230928134710-13f48a72 npm ↗︎ unpkg ↗︎

@renovate renovate bot force-pushed the renovate/major-prisma-monorepo branch 2 times, most recently from 890f11f to e8577d9 Compare September 18, 2023 23:49
@renovate renovate bot force-pushed the renovate/major-prisma-monorepo branch 4 times, most recently from 7b85c64 to 06f51ad Compare October 4, 2023 22:27
@renovate renovate bot force-pushed the renovate/major-prisma-monorepo branch from 4a4bc98 to 9bf3be6 Compare October 22, 2023 22:10
@renovate
Copy link
Contributor Author

renovate bot commented Oct 23, 2023

Edited/Blocked Notification

Renovate will not automatically rebase this PR, because it does not recognize the last commit author and assumes somebody else may have edited the PR.

You can manually request rebase by checking the rebase/retry box above.

Warning: custom changes will be lost.

Copy link
Contributor Author

renovate bot commented Apr 30, 2024

Autoclosing Skipped

This PR has been flagged for autoclosing. However, it is being skipped due to the branch being already modified. Please close/delete it manually or report a bug if you think this is in error.

@renovate renovate bot changed the title chore(deps): update prisma monorepo to v5 (major) chore(deps): update prisma monorepo to v5 (major) - abandoned Apr 30, 2024
@dimaMachina dimaMachina closed this Jul 3, 2024
@dimaMachina dimaMachina deleted the renovate/major-prisma-monorepo branch July 3, 2024 08:55
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
dependencies Pull requests that update a dependency file
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant