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 monorepo to v4.5.0 #6485

Merged
merged 1 commit into from
Oct 31, 2022
Merged

Conversation

renovate[bot]
Copy link
Contributor

@renovate renovate bot commented Oct 1, 2022

Mend Renovate

This PR contains the following updates:

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

Release Notes

prisma/prisma

v4.5.0

Compare Source

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

Major improvements

Filter for non-unique properties in unique where queries (Preview)

In this release, we are adding support for non-unique properties inside the where statement for queries that operate on a unique record (e.g.: findUnique, update, delete, etc.). This was not possible in the past, as we only allowed unique fields as filters inside the where statement for the queries in question.

There are use cases where a query that operates on a unique record requires further filtering by non-unique properties. For example, for the following model:

model Article {
  id      Int    @​id @​default(autoincrement())
  content String
  version Int
}

Let’s say that you would like to update the Article with an id of “5”, but only if the version equals "1":

await prisma.article.update({
    where: { id: 5, version: 1 }, // `version` field was not available before Prisma 4.5.0
    data: {
        content: "Incredible new story",
        version: { increment: 1 },
    },
});

With 4.5.0, we are adding support to specify any number of non-unique fields in your where statement, as long as you have at least one unique field.

To use it, enable the Preview feature flag:

generator js {
  provider        = "prisma-client-js"
  previewFeatures = ["extendedWhereUnique"]
}

To learn more about this feature and about use cases where it can be useful, please check out our documentation. For feedback, please leave a comment on the GitHub issue.

PostgreSQL extension management (Preview)

We are excited to add support for declaring PostgreSQL extensions in the Prisma schema. The feature comes with support for introspection and migrations. This will allow you to adopt, evolve and manage which PostgreSQL database extensions are installed directly from within your Prisma schema.

💡 This feature adds support to manage PostgreSQL extensions in Prisma schema. It does not provide additional query capabilities and datatypes in Prisma Client.

To try this feature, enable the Preview feature flag:

generator client {
  provider        = "prisma-client-js"
  previewFeatures = ["postgresqlExtensions"]
}

datasource db {
  provider = "postgresql"
  url      = env("DATABASE_URL")
}

Now you will be able to use the new extensions property in the datasource block of your Prisma schema.

datasource db {
  provider   = "postgresql"
  url        = env("DATABASE_URL")
  extensions = [hstore(schema: "myHstoreSchema"), pg_tgrm, postgis(version: "2.1")]
}

⚠️ To avoid noise from introspection, we currently only introspect the following allow-list: citext, pgcrypto, uuid-ossp, and postgis. But you can add and configure any extension to your Prisma schema manually.

Please visit our documentation to learn more about this feature or leave a comment with feedback on the GitHub issue.

Change to Referential Integrity — property in datasource block renamed to relationMode (Preview)

To prepare Prisma Client’s emulation of relations for general availability, we are releasing several improvements to the referentialIntegrity Preview feature.

We decided to rename the feature to Relation Mode. We think this closer reflects what this feature does and distinguishes it from integrity management on the database level. The related property in the datasource block of the Prisma schema has also been changed from referentialIntegrity to relationMode.

⚠️ The Preview feature flag inside the generator block of the Prisma schema is still called referentialIntegrity.

To use it, keep using the old referentialIntegrity Preview feature flag:

generator js {
  provider        = "prisma-client-js"
  previewFeatures = ["referentialIntegrity"]
}

But use the new property name in the datasource:

datasource db {
  provider     = "mysql"
  url          = env("DATABASE_URL")
  relationMode = "prisma"
}

We also removed the referential action NoAction for PostgreSQL and SQLite when using relationMode = "prisma" as we are not planning to support the details of the database behavior.

To learn more about relationMode, please check out the documentation or leave a comment on the GitHub issue.

Deno for Prisma Client for Data Proxy (Preview)

Deno is an alternative JavaScript runtime that can replace Node.js to run JS and TS apps. It aligns itself closely with web technologies, claims to be secure by default, and supports TypeScript out of the box.

Today we are releasing initial support for Prisma with Deno via an integration for our Prisma Client for Data Proxy. This feature was developed together with the amazing team at Deno 🦕.

To use Prisma Client in a Deno project, add the deno Preview feature flag to your Prisma schema and define a folder as output (this is required for Deno):

generator client {
  provider        = "prisma-client-js"
  previewFeatures = ["deno"]
  output          = "../generated/client"
}

Now you can generate Prisma Client with the Data Proxy using the command npx prisma generate --data-proxy. Then use Prisma Client in your Deno script with the following import:

import { PrismaClient } from './generated/client/deno/edge.ts'

const prisma = new PrismaClient()

async function main() {
    const users = await prisma.user.findMany()
    console.log({ users })
}

main()

You can also deploy an app built and configured like this on Deno Deploy, Deno’s deployment platform. Read this guide in our documentation for a full example and individual steps.

For feedback, please comment on this GitHub issue.

Fixed “Invalid string length” error in Prisma Studio and Prisma Data Platform Data Browser

Many people were having issues with an "Invalid string length" error both in Prisma Studio and Prisma Data Platform Data Browser. This issue can be resolved through this workaround. With this release, the root cause of this issue has been fixed and it should not occur again.

Updated proposal for Client Extensions: request for comments

In 4.3.0, we shared a proposal for Prisma Client Extensions on Github. We received a lot of great feedback, which we have incorporated into a new proposal.

If you’re interested, please head over to the new proposal in GitHub and tell us what you think. Thank you!

Fixes and improvements

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

Credits

Huge thanks to @​kt3k, @​abenhamdine, @​jsoref for helping!

v4.4.0

Compare Source

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

Major improvements

General improvements

In the last sprint, we focused our efforts on squashing as many bugs as we could. You can find the full list of improvements and bug fixes in the Fixes and improvements section below.

Some of the improvements we made include but are not limited to:

  • Improved optimistic concurrency control (GitHub issue)
  • Improved decimal precision
  • Improved handling of big amounts of prepared statement placeholders:
    Databases impose limits when they hit a specific number, and when a query (either generated by Prisma Client or provided by the user directly as a raw query) hits it some users ran into a misleading Can't reach database server error message (GitHub issue). The error message will now be more useful (P2035 error code), and Prisma Client should not cause these errors anymore.

If you notice any regression, please make sure to create a GitHub issue. We touched a lot of code in this sprint, and even though we are confident in our tests, something might have slipped through the cracks. We'd like to fix the regressions as soon as possible.

isolationLevel for sequential transaction operations

In version 4.2.0, we added support for setting transaction isolation levels for interactive transactions (Preview). You can now define isolation levels for sequential transaction operations: prisma.$transaction([]).

Isolation levels describe different types of trade-offs between isolation and performance that databases can make when processing transactions. Isolation levels determine what types of data leaking can occur between transactions or what data anomalies can occur.
To set the transaction isolation level, use the isolationLevel option in the second parameter of the API. For example:

await prisma.$transaction(
  [
    // sequential operations
    prisma.user.create({ data: {/** args */ } }),
    prisma.post.create({ data: {/** args  */ } })
  ],
  {
    isolationLevel: Prisma.TransactionIsolationLevel.Serializable
  }
)

Prisma Client supports the following isolation levels if they're available in your database provider:

  • ReadCommitted
  • ReadUncommitted
  • RepeatableRead
  • Serializable
  • Snapshot

Learn more about it in our documentation.

New P2034 error code for transaction conflicts or deadlocks

When using certain isolation levels, it is expected that a transaction can fail due to a write conflict or a deadlock, throwing an error. One way to solve these cases is by retrying the transaction.

To make this easier, we're introducing a new PrismaClientKnownRequestError with the error code P2034: "Transaction failed due to a write conflict or a deadlock. Please retry your transaction". You can programmatically catch the error and retry the transaction. Here's an example showing how you can retry a transaction:

import { Prisma, PrismaClient } from '@​prisma/client'

const prisma = new PrismaClient()
async function main() {
  const MAX_RETRIES = 5
  let retries = 0;

  let result;
  while (retries < MAX_RETRIES) {
    try {
      result = await prisma.$transaction(
        [
          prisma.user.deleteMany({ where: { /**  args */ } }),
          prisma.post.createMany({ data: { /**  args */ } })
        ],
        {
          isolationLevel: Prisma.TransactionIsolationLevel.Serializable
        }
      )
    } catch (error) {
      if (error.code === 'P2034') {
        retries++
        continue
      }
      throw error
    }
  }
}

Fixes and improvements

Prisma Client
Prisma
Prisma Migrate
Prisma Studio

Credits

Huge thanks to @​abenhamdine, @​miguelgargallo, @​Clansty, @​panoplied, @​MEnnabah, @​drzamich, @​AndrewSouthpaw, @​kt3k 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 looking for a Developer Advocate (Frontend / Fullstack) and Back-end Engineer: Prisma Data Platform.

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

Prisma Data Platform

We're working on the Prisma Data Platform — a collaborative environment for connecting apps to databases. It includes the:

  • Data Browser for navigating, editing, and querying data
  • Data Proxy for your database's persistent, reliable, and scalable connection pooling.
  • Query Console for experimenting with queries

Try it out and let us know what you think!

📺 Join us for another "What's new in Prisma" livestream

Learn about the latest release and other news from the Prisma community by joining us for another "What's new in Prisma" livestream.

The stream takes place on YouTube on Thursday, September 29 at 5 pm Berlin | 8 am San Francisco.


Configuration

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

🚦 Automerge: Enabled.

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 release:chore This PR is a chore (means nothing for users) label Oct 1, 2022
@renovate renovate bot force-pushed the renovate/prisma-monorepo branch 8 times, most recently from 9c04022 to 88e047b Compare October 1, 2022 20:53
@jtoar jtoar added release:feature This PR introduces a new feature and removed release:chore This PR is a chore (means nothing for users) labels Oct 5, 2022
@renovate renovate bot force-pushed the renovate/prisma-monorepo branch 2 times, most recently from 35849e9 to b1b81aa Compare October 7, 2022 01:11
@renovate renovate bot force-pushed the renovate/prisma-monorepo branch 14 times, most recently from 50dbf95 to 39a3a4b Compare October 7, 2022 21:49
@renovate renovate bot force-pushed the renovate/prisma-monorepo branch from 6458da2 to 34b0e88 Compare October 18, 2022 17:35
@renovate renovate bot changed the title fix(deps): update prisma monorepo to v4.4.0 fix(deps): update prisma monorepo to v4.5.0 Oct 18, 2022
@renovate renovate bot force-pushed the renovate/prisma-monorepo branch 11 times, most recently from 2d2caf1 to ec7af0b Compare October 31, 2022 13:59
@jtoar jtoar self-assigned this Oct 31, 2022
@renovate renovate bot force-pushed the renovate/prisma-monorepo branch from ec7af0b to d7dea97 Compare October 31, 2022 19:42
@jtoar jtoar merged commit a388889 into main Oct 31, 2022
@jtoar jtoar deleted the renovate/prisma-monorepo branch October 31, 2022 22:02
@redwoodjs-bot redwoodjs-bot bot added this to the next-release milestone Oct 31, 2022
@redwoodjs-bot
Copy link

redwoodjs-bot bot commented Oct 31, 2022

🔔 @jtoar, @Tobbe—I couldn't cherry pick this one. If you want it in the next release, you'll have to cherry pick it manually.

@jtoar jtoar modified the milestones: next-release, v3.4.0 Nov 3, 2022
dac09 added a commit that referenced this pull request Nov 7, 2022
…aching

* 'main' of github.com:redwoodjs/redwood: (21 commits)
  [Tutorial]: Fix Typescript code blocks inconsistency (#6801)
  chore: update all contributors
  Custom auth: Fix comment in template (#6804)
  fix(deps): update dependency eslint to v8.26.0 (#6785)
  [CRWA]: Switch to using enquirer, add engine compatibility override option (#6723)
  (docs): Minor Command update about Storybook (#6722)
  docs: Add mocking useLocation to docs (#6791)
  Update generated render.yaml (#6771)
  fix flightcontrol config template (#6789)
  fix: publish canary using premajor (#6794)
  Strip resetToken and resetTokenExpiresAt from dbAuth forgotPassword handler (#6778)
  Fix WebAuthn when event body is base64 encoded (like when deploying to Vercel) (#6757)
  fix(deps): update jest monorepo (#6787)
  fix(deps): update dependency react-hook-form to v7.39.1 (#6786)
  fix(deps): update dependency fastify to v4.9.2 (#6781)
  fix(deps): update dependency @apollo/client to v3.7.1 (#6780)
  chore: fix and rebuild test project fixture (#6775)
  fix: add prisma resolutions to tutorial e2e test proj (#6772)
  fix(deps): update prisma monorepo to v4.5.0 (#6485)
  Fix dbauth webauthn template (redundant type import) (#6769)
  ...
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
release:feature This PR introduces a new feature
Projects
Status: Done
Development

Successfully merging this pull request may close these issues.

1 participant