From 15a806c08a73e3a047fe2657f4762b5041a56200 Mon Sep 17 00:00:00 2001 From: meletj Date: Fri, 5 Apr 2024 18:53:33 +0200 Subject: [PATCH 1/2] swap alert -> danger for admonition --- .../20-relations/410-referential-actions/index.mdx | 2 +- .../100-prisma-schema/20-data-model/50-database-mapping.mdx | 2 +- .../200-special-fields-and-types/080-null-and-undefined.mdx | 4 ++++ .../200-prisma-client/450-testing/100-unit-testing.mdx | 2 +- .../300-workflows/90-development-and-production.mdx | 2 +- .../500-reference/300-environment-variables-reference.mdx | 2 +- .../600-upgrading-to-prisma-5/index.mdx | 2 +- .../200-upgrading-versions/700-upgrading-to-prisma-4.mdx | 2 +- .../800-upgrading-to-prisma-3/150-referential-actions.mdx | 2 +- .../800-upgrading-to-prisma-3/index.mdx | 2 +- .../300-upgrade-guides/200-upgrading-versions/index.mdx | 2 +- 11 files changed, 14 insertions(+), 10 deletions(-) diff --git a/content/200-orm/100-prisma-schema/20-data-model/20-relations/410-referential-actions/index.mdx b/content/200-orm/100-prisma-schema/20-data-model/20-relations/410-referential-actions/index.mdx index ef6d0b3625..db14280cd3 100644 --- a/content/200-orm/100-prisma-schema/20-data-model/20-relations/410-referential-actions/index.mdx +++ b/content/200-orm/100-prisma-schema/20-data-model/20-relations/410-referential-actions/index.mdx @@ -41,7 +41,7 @@ If you do not specify a referential action, Prisma ORM [uses a default](#referen - + If you upgrade from a version earlier than 2.26.0: It is extremely important that you check the [upgrade paths for referential actions](/orm/more/upgrade-guides/upgrading-versions/upgrading-to-prisma-3/referential-actions) section. Prisma ORM's support of referential actions **removes the safety net in Prisma Client that prevents cascading deletes at runtime**. If you use the feature _without upgrading your database_, the [old default action](/orm/more/upgrade-guides/upgrading-versions/upgrading-to-prisma-3/referential-actions#prisma-orm-2x-default-referential-actions) - `ON DELETE CASCADE` - becomes active. This might result in cascading deletes that you did not expect. diff --git a/content/200-orm/100-prisma-schema/20-data-model/50-database-mapping.mdx b/content/200-orm/100-prisma-schema/20-data-model/50-database-mapping.mdx index 65f8d67638..377c8c290b 100644 --- a/content/200-orm/100-prisma-schema/20-data-model/50-database-mapping.mdx +++ b/content/200-orm/100-prisma-schema/20-data-model/50-database-mapping.mdx @@ -84,7 +84,7 @@ You can optionally use the `map` argument to explicitly define the **underlying When introspecting a database, the `map` argument will _only_ be rendered in the schema if the name _differs_ from Prisma ORM's [default constraint naming convention for indexes and constraints](#prisma-orms-default-naming-conventions-for-indexes-and-constraints). - + If you use Prisma Migrate in a version earlier than 2.29.0 and want to maintain your existing constraint and index names after upgrading to a newer version, **do not** immediately run `prisma migrate` or `prisma db push`. This will **change any underlying constraint name that does not follow Prisma ORM's convention**. Follow the [upgrade path that allows you to maintain existing constraint and index names](/orm/more/upgrade-guides/upgrading-versions/upgrading-to-prisma-3/named-constraints#option-1-i-want-to-maintain-my-existing-constraint-and-index-names). diff --git a/content/200-orm/200-prisma-client/200-special-fields-and-types/080-null-and-undefined.mdx b/content/200-orm/200-prisma-client/200-special-fields-and-types/080-null-and-undefined.mdx index 505f26e3a3..e0b058c0e7 100644 --- a/content/200-orm/200-prisma-client/200-special-fields-and-types/080-null-and-undefined.mdx +++ b/content/200-orm/200-prisma-client/200-special-fields-and-types/080-null-and-undefined.mdx @@ -257,8 +257,10 @@ updateUser: (parent, args, ctx: Context) => { return ctx.prisma.user.update({ where: { id: Number(args.id) }, data: { + //highlight-start | email: args.authorEmail, // email cannot be null | name: args.authorName // name set to null - potentially unwanted behavior + //highlight-end }, }) }, @@ -271,8 +273,10 @@ updateUser: (parent, args, ctx: Context) => { return ctx.prisma.user.update({ where: { id: Number(args.id) }, data: { + //highlight-start | email: args.authorEmail != null ? args.authorEmail : undefined, // If null, do nothing | name: args.authorName != null ? args.authorName : undefined // If null, do nothing + //highlight-end }, }) }, diff --git a/content/200-orm/200-prisma-client/450-testing/100-unit-testing.mdx b/content/200-orm/200-prisma-client/450-testing/100-unit-testing.mdx index ef0d33450a..62c65f5577 100644 --- a/content/200-orm/200-prisma-client/450-testing/100-unit-testing.mdx +++ b/content/200-orm/200-prisma-client/450-testing/100-unit-testing.mdx @@ -37,7 +37,7 @@ This guide will cover two approaches to mocking Prisma Client, a singleton insta npm install jest-mock-extended@2.0.4 --save-dev ``` - + At the time of writing, this guide uses `jest-mock-extended` version `^2.0.4`. diff --git a/content/200-orm/300-prisma-migrate/300-workflows/90-development-and-production.mdx b/content/200-orm/300-prisma-migrate/300-workflows/90-development-and-production.mdx index 2608d47535..4dacf62838 100644 --- a/content/200-orm/300-prisma-migrate/300-workflows/90-development-and-production.mdx +++ b/content/200-orm/300-prisma-migrate/300-workflows/90-development-and-production.mdx @@ -21,7 +21,7 @@ npx prisma migrate dev ### Create and apply migrations - + `migrate dev` is a development command and should never be used in a production environment. diff --git a/content/200-orm/500-reference/300-environment-variables-reference.mdx b/content/200-orm/500-reference/300-environment-variables-reference.mdx index e4fffb7ae9..cdde6aeeeb 100644 --- a/content/200-orm/500-reference/300-environment-variables-reference.mdx +++ b/content/200-orm/500-reference/300-environment-variables-reference.mdx @@ -246,7 +246,7 @@ The Introspection Engine is served by the Migration Engine from [4.9.0](https:// #### `PRISMA_FMT_BINARY` - + This functionality has been removed in Prisma CLI version 4.10.0. It only works in earlier versions. diff --git a/content/200-orm/800-more/300-upgrade-guides/200-upgrading-versions/600-upgrading-to-prisma-5/index.mdx b/content/200-orm/800-more/300-upgrade-guides/200-upgrading-versions/600-upgrading-to-prisma-5/index.mdx index c8575ab412..264742085f 100644 --- a/content/200-orm/800-more/300-upgrade-guides/200-upgrading-versions/600-upgrading-to-prisma-5/index.mdx +++ b/content/200-orm/800-more/300-upgrade-guides/200-upgrading-versions/600-upgrading-to-prisma-5/index.mdx @@ -47,7 +47,7 @@ pnpm upgrade prisma@5 @prisma/client@5 - + Before you upgrade, check each breaking change below to see how the upgrade might affect your application. diff --git a/content/200-orm/800-more/300-upgrade-guides/200-upgrading-versions/700-upgrading-to-prisma-4.mdx b/content/200-orm/800-more/300-upgrade-guides/200-upgrading-versions/700-upgrading-to-prisma-4.mdx index 78eb12c2ed..4d6f5dd47a 100644 --- a/content/200-orm/800-more/300-upgrade-guides/200-upgrading-versions/700-upgrading-to-prisma-4.mdx +++ b/content/200-orm/800-more/300-upgrade-guides/200-upgrading-versions/700-upgrading-to-prisma-4.mdx @@ -451,7 +451,7 @@ To upgrade to Prisma ORM 4 from an earlier version, you need to update both the To ignore the caret `^` and upgrade across major versions, you can use the `@4` tag when you upgrade with `npm`, or `yarn`: - + Before you upgrade, check each **breaking change** to see how the upgrade might affect your application. diff --git a/content/200-orm/800-more/300-upgrade-guides/200-upgrading-versions/800-upgrading-to-prisma-3/150-referential-actions.mdx b/content/200-orm/800-more/300-upgrade-guides/200-upgrading-versions/800-upgrading-to-prisma-3/150-referential-actions.mdx index d898c2b2d3..542d5a76a5 100644 --- a/content/200-orm/800-more/300-upgrade-guides/200-upgrading-versions/800-upgrading-to-prisma-3/150-referential-actions.mdx +++ b/content/200-orm/800-more/300-upgrade-guides/200-upgrading-versions/800-upgrading-to-prisma-3/150-referential-actions.mdx @@ -57,7 +57,7 @@ When you run an Introspection, Prisma ORM compares all the foreign keys in the d After introspecting, you can review the non-default clauses in your schema. The most important clause to review is `onDelete`, which defaults to `Cascade` in version 2.25.0 and earlier. - + If you are using either the [`delete()`](/orm/prisma-client/queries/crud#delete-a-single-record) or [`deleteAll()`](/orm/prisma-client/queries/crud#delete-all-records) methods, **cascading deletes will now be performed, as the safety net in Prisma Client that previously prevented cascading deletes at runtime is removed**. Be sure to check your code and make any adjustments accordingly. diff --git a/content/200-orm/800-more/300-upgrade-guides/200-upgrading-versions/800-upgrading-to-prisma-3/index.mdx b/content/200-orm/800-more/300-upgrade-guides/200-upgrading-versions/800-upgrading-to-prisma-3/index.mdx index ed4114d024..cff1bdc4d6 100644 --- a/content/200-orm/800-more/300-upgrade-guides/200-upgrading-versions/800-upgrading-to-prisma-3/index.mdx +++ b/content/200-orm/800-more/300-upgrade-guides/200-upgrading-versions/800-upgrading-to-prisma-3/index.mdx @@ -134,7 +134,7 @@ To upgrade from version 2.x to 3.x, you need to update both the `prisma` and `@p To ignore the caret `^` and upgrade across major versions, you can use the `@3` tag when upgrading with `npm`, or `yarn` . - + Before upgrading, check each **breaking change** to see how the upgrade might affect your application. diff --git a/content/200-orm/800-more/300-upgrade-guides/200-upgrading-versions/index.mdx b/content/200-orm/800-more/300-upgrade-guides/200-upgrading-versions/index.mdx index 229024efab..1da7aa1c8e 100644 --- a/content/200-orm/800-more/300-upgrade-guides/200-upgrading-versions/index.mdx +++ b/content/200-orm/800-more/300-upgrade-guides/200-upgrading-versions/index.mdx @@ -48,7 +48,7 @@ To install the latest `dev` distribution tag: npm install @prisma/client@dev prisma@dev ``` - + Do not use the `dev` distribution tag in production - wait until the official release that contains the features and fixes you are interested in is released. For example, fixes present `@prisma/client@2.23.0-dev.25` will eventually be released as part of `@prisma/client@2.23.0`. From 71a11468b1205a4e509d372ae7ff591b194e949a Mon Sep 17 00:00:00 2001 From: meletj Date: Fri, 5 Apr 2024 21:01:54 +0200 Subject: [PATCH 2/2] fixes post rebase --- .../100-introduction/100-what-is-prisma.mdx | 2 +- .../500-databases/840-cockroachdb.mdx | 8 ++-- .../500-databases/850-planetscale.mdx | 2 +- .../20-relations/420-relation-mode.mdx | 2 + .../20-data-model/20-relations/index.mdx | 1 + .../100-queries/037-relation-queries.mdx | 41 +++++++++++++++++++ .../056-aggregation-grouping-summarizing.mdx | 10 +++++ .../100-queries/058-transactions.mdx | 4 ++ .../100-queries/060-full-text-search.mdx | 1 + .../400-deploy-to-aws-lambda.mdx | 25 ++++++----- .../201-serverless/500-deploy-to-netlify.mdx | 2 +- .../301-edge/450-deploy-to-cloudflare.mdx | 27 ++++++------ .../301-edge/485-deploy-to-vercel.mdx | 29 +++++++------ ...aveats-when-deploying-to-aws-platforms.mdx | 2 +- .../200-shadow-database.mdx | 13 +++--- .../01-migrate-from-typeorm.mdx | 10 ++--- .../300-accelerate/200-getting-started.mdx | 2 +- content/400-pulse/200-getting-started.mdx | 8 ++-- .../500-platform/60-platform-cli/index.mdx | 2 + 19 files changed, 130 insertions(+), 61 deletions(-) diff --git a/content/200-orm/050-overview/100-introduction/100-what-is-prisma.mdx b/content/200-orm/050-overview/100-introduction/100-what-is-prisma.mdx index e9590c040a..66c3fd18d5 100644 --- a/content/200-orm/050-overview/100-introduction/100-what-is-prisma.mdx +++ b/content/200-orm/050-overview/100-introduction/100-what-is-prisma.mdx @@ -45,7 +45,7 @@ datasource db { provider = "postgresql" url = env("DATABASE_URL") } -//add-next-line + generator client { provider = "prisma-client-js" } diff --git a/content/200-orm/050-overview/500-databases/840-cockroachdb.mdx b/content/200-orm/050-overview/500-databases/840-cockroachdb.mdx index 9dba032f7e..af9399a8ca 100644 --- a/content/200-orm/050-overview/500-databases/840-cockroachdb.mdx +++ b/content/200-orm/050-overview/500-databases/840-cockroachdb.mdx @@ -64,7 +64,7 @@ CREATE TABLE public."Post" ( After introspecting your database with `npx prisma db pull`, you will have a new `Post` model in your `schema.prisma` file: -```prisma file=schema.prisma +```prisma file=schema.prisma showLineNumbers model Post { id BigInt @id title String @db.String(200) @@ -81,7 +81,7 @@ When generating unique identifiers for records in a distributed database like Co Instead, Prisma ORM provides the [`autoincrement()`](/orm/reference/prisma-schema-reference#autoincrement) attribute function, which uses CockroachDB's [`unique_rowid()` function](https://www.cockroachlabs.com/docs/stable/serial.html) for generating unique identifiers. For example, the following `User` model has an `id` primary key, generated using the `autoincrement()` function: -```prisma file=schema.prisma +```prisma file=schema.prisma showLineNumbers model User { id BigInt @id @default(autoincrement()) name String @@ -96,7 +96,7 @@ For more information on generating database keys, see CockroachDB's [Primary key To connect to a CockroachDB database server, you need to configure a [`datasource`](/orm/prisma-schema/overview/data-sources) block in your [Prisma schema file](/orm/prisma-schema): -```prisma file=schema.prisma +```prisma file=schema.prisma showLineNumbers datasource db { provider = "cockroachdb" url = env("DATABASE_URL") @@ -204,7 +204,7 @@ When introspecting a CockroachDB database, the database types are mapped to Pris [Introspection](/orm/prisma-schema/introspection) adds native database types that are **not yet supported** as [`Unsupported`](/orm/reference/prisma-schema-reference#unsupported) fields: -```prisma file=schema.prisma +```prisma file=schema.prisma showLineNumbers model Device { id BigInt @id @default(autoincrement()) interval Unsupported("INTERVAL") diff --git a/content/200-orm/050-overview/500-databases/850-planetscale.mdx b/content/200-orm/050-overview/500-databases/850-planetscale.mdx index bfc0bf1900..1591e404ea 100644 --- a/content/200-orm/050-overview/500-databases/850-planetscale.mdx +++ b/content/200-orm/050-overview/500-databases/850-planetscale.mdx @@ -150,7 +150,7 @@ You can then use Prisma ORM and define relations in your Prisma schema without t In that case, you can define a relation as with other database that supports foreign key constraints, for example: -```prisma file=schema.prisma +```prisma file=schema.prisma showLineNumbers model Post { id Int @id @default(autoincrement()) title String diff --git a/content/200-orm/100-prisma-schema/20-data-model/20-relations/420-relation-mode.mdx b/content/200-orm/100-prisma-schema/20-data-model/20-relations/420-relation-mode.mdx index 43d7991877..03297d5508 100644 --- a/content/200-orm/100-prisma-schema/20-data-model/20-relations/420-relation-mode.mdx +++ b/content/200-orm/100-prisma-schema/20-data-model/20-relations/420-relation-mode.mdx @@ -56,10 +56,12 @@ CREATE TABLE "User" ( ); -- AddForeignKey +//highlight-start ALTER TABLE "Post" ADD CONSTRAINT "Post_authorId_fkey" FOREIGN KEY ("authorId") REFERENCES "User"("id") ON DELETE CASCADE ON UPDATE CASCADE; +//highlight-end ``` In this case, the foreign key constraint on the `authorId` column of the `Post` table references the `id` column of the `User` table, and guarantees that a post must have an author that exists. If you update or delete a user then the `ON DELETE` and `ON UPDATE` referential actions specify the `CASCADE` option, which will also delete or update all posts belonging to the user. diff --git a/content/200-orm/100-prisma-schema/20-data-model/20-relations/index.mdx b/content/200-orm/100-prisma-schema/20-data-model/20-relations/index.mdx index 1cbf0cc3be..8ec8100306 100644 --- a/content/200-orm/100-prisma-schema/20-data-model/20-relations/index.mdx +++ b/content/200-orm/100-prisma-schema/20-data-model/20-relations/index.mdx @@ -179,6 +179,7 @@ const getAuthor = await prisma.user.findUnique({ id: "20", }, include: { + //highlight-next-line | posts: true, // All posts where authorId == 20 }, }); diff --git a/content/200-orm/200-prisma-client/100-queries/037-relation-queries.mdx b/content/200-orm/200-prisma-client/100-queries/037-relation-queries.mdx index 5775494807..ded2e8d808 100644 --- a/content/200-orm/200-prisma-client/100-queries/037-relation-queries.mdx +++ b/content/200-orm/200-prisma-client/100-queries/037-relation-queries.mdx @@ -475,12 +475,14 @@ const result = await prisma.user.create({ data: { email: 'elsa@prisma.io', name: 'Elsa Prisma', + //highlight-start posts: { create: [ { title: 'How to make an omelette' }, { title: 'How to eat an omelette' }, ], }, + //highlight-end }, include: { posts: true, // Include all posts in the returned object @@ -559,6 +561,7 @@ const result = await prisma.user.create({ data: { email: 'yvette@prisma.io', name: 'Yvette', + //highlight-start posts: { create: [ { @@ -572,6 +575,7 @@ const result = await prisma.user.create({ { title: 'How to eat an omelette' }, ], }, + //highlight-end }, include: { // Include posts @@ -645,11 +649,13 @@ The example uses a nested `include` to include all posts. const result = await prisma.user.create({ data: { email: 'saanvi@prisma.io', + //highlight-start posts: { createMany: { data: [{ title: 'My first post' }, { title: 'My second post' }], }, }, + //highlight-end }, include: { posts: true, @@ -743,9 +749,11 @@ The following query creates ([`create`](/orm/reference/prisma-client-reference#c const result = await prisma.user.create({ data: { email: 'vlad@prisma.io', + //highlight-start posts: { connect: [{ id: 8 }, { id: 9 }, { id: 10 }], }, + //highlight-end }, include: { posts: true, // Include all posts in the returned object @@ -793,10 +801,12 @@ const result = await prisma.user.update({ id: 9, }, data: { + //highlight-start posts: { connect: { id: 11, }, + //highlight-end }, }, include: { @@ -819,6 +829,7 @@ If a related record may or may not already exist, use [`connectOrCreate`](/orm/r const result = await prisma.post.create({ data: { title: 'How to make croissants', + //highlight-start author: { connectOrCreate: { where: { @@ -830,6 +841,7 @@ const result = await prisma.post.create({ }, }, }, + //highlight-end }, include: { author: true, @@ -875,9 +887,11 @@ const result = await prisma.user.update({ id: 16, }, data: { + //highlight-start posts: { disconnect: [{ id: 12 }, { id: 19 }], }, + //highlight-end }, include: { posts: true, @@ -914,9 +928,11 @@ const result = await prisma.post.update({ id: 23, }, data: { + //highlight-start author: { disconnect: true, }, + //highlight-end }, include: { author: true, @@ -956,9 +972,11 @@ const result = await prisma.user.update({ id: 16, }, data: { + //highlight-start posts: { set: [], }, + //highlight-end }, include: { posts: true, @@ -994,9 +1012,11 @@ const result = await prisma.user.update({ id: 11, }, data: { + //highlight-start posts: { deleteMany: {}, }, + //highlight-end }, include: { posts: true, @@ -1014,11 +1034,13 @@ const result = await prisma.user.update({ id: 11, }, data: { + //highlight-start posts: { deleteMany: { published: false, }, }, + //highlight-end }, include: { posts: true, @@ -1034,9 +1056,11 @@ const result = await prisma.user.update({ id: 6, }, data: { + //highlight-start posts: { deleteMany: [{ id: 7 }], }, + //highlight-end }, include: { posts: true, @@ -1054,6 +1078,7 @@ const result = await prisma.user.update({ id: 6, }, data: { + //highlight-start posts: { updateMany: { where: { @@ -1064,6 +1089,7 @@ const result = await prisma.user.update({ }, }, }, + //highlight-end }, include: { posts: true, @@ -1079,6 +1105,7 @@ const result = await prisma.user.update({ id: 6, }, data: { + //highlight-start posts: { update: { where: { @@ -1089,6 +1116,7 @@ const result = await prisma.user.update({ }, }, }, + //highlight-end }, include: { posts: true, @@ -1106,6 +1134,7 @@ const result = await prisma.post.update({ id: 6, }, data: { + //highlight-start author: { upsert: { create: { @@ -1118,6 +1147,7 @@ const result = await prisma.post.update({ }, }, }, + //highlight-end }, include: { author: true, @@ -1135,11 +1165,13 @@ const result = await prisma.user.update({ id: 9, }, data: { + //highlight-start posts: { createMany: { data: [{ title: 'My first post' }, { title: 'My second post' }], }, }, + //highlight-end }, include: { posts: true, @@ -1169,6 +1201,7 @@ For example, the following query returns `User` that meet the following criteria ```ts highlight=3-14;normal const users = await prisma.user.findMany({ where: { + //highlight-start posts: { none: { views: { @@ -1181,6 +1214,7 @@ const users = await prisma.user.findMany({ }, }, }, + //highlight-end }, include: { posts: true, @@ -1200,6 +1234,7 @@ For example, the following query returns `Post` records that meet the following ```ts highlight=3-13;normal const users = await prisma.post.findMany({ where: { + //highlight-start author: { isNot: { name: 'Bob', @@ -1211,6 +1246,7 @@ const users = await prisma.post.findMany({ }, }, }, + //highlight-end include: { author: true, }, @@ -1224,9 +1260,11 @@ For example, the following query uses `none` to return all users that have zero ```ts highlight=3-5;normal const usersWithZeroPosts = await prisma.user.findMany({ where: { + //highlight-start posts: { none: {}, }, + //highlight-end }, include: { posts: true, @@ -1241,6 +1279,7 @@ The following query returns all posts that don't have an author relation: ```js highlight=3;normal const postsWithNoAuthor = await prisma.post.findMany({ where: { + //highlight-next-line author: null, // or author: { } }, include: { @@ -1256,9 +1295,11 @@ The following query returns all users with at least one post: ```ts highlight=3-5;normal const usersWithSomePosts = await prisma.user.findMany({ where: { + //highlight-start posts: { some: {}, }, + //highlight-end }, include: { posts: true, diff --git a/content/200-orm/200-prisma-client/100-queries/056-aggregation-grouping-summarizing.mdx b/content/200-orm/200-prisma-client/100-queries/056-aggregation-grouping-summarizing.mdx index 431e389ad8..72ab5231b2 100644 --- a/content/200-orm/200-prisma-client/100-queries/056-aggregation-grouping-summarizing.mdx +++ b/content/200-orm/200-prisma-client/100-queries/056-aggregation-grouping-summarizing.mdx @@ -160,11 +160,13 @@ Use `where` to filter all records **before grouping**. The following example gro ```ts highlight=3-7;normal const groupUsers = await prisma.user.groupBy({ by: ['country'], + //highlight-start where: { email: { contains: 'prisma.io', }, }, + //highlight-end _sum: { profileViews: true, }, @@ -186,6 +188,7 @@ const groupUsers = await prisma.user.groupBy({ _sum: { profileViews: true, }, + //highlight-start having: { profileViews: { _avg: { @@ -193,6 +196,7 @@ const groupUsers = await prisma.user.groupBy({ }, }, }, + //highlight-end }) ``` @@ -206,9 +210,11 @@ For example, the following query groups all users that are _not_ from Sweden or const fd = await prisma.user.groupBy({ by: ['country'], where: { + //highlight-start country: { notIn: ['Sweden', 'Ghana'], }, + //highlight-end }, _sum: { profileViews: true, @@ -229,17 +235,21 @@ The following query technically achieves the same result, but excludes users fro const groupUsers = await prisma.user.groupBy({ by: ['country'], where: { + //highlight-start country: { not: 'Sweden', }, + //highlight-end }, _sum: { profileViews: true, }, having: { + //highlight-start country: { not: 'Ghana', }, + //highlight-end profileViews: { _min: { gte: 10, diff --git a/content/200-orm/200-prisma-client/100-queries/058-transactions.mdx b/content/200-orm/200-prisma-client/100-queries/058-transactions.mdx index 0e9f47616a..df61276be9 100644 --- a/content/200-orm/200-prisma-client/100-queries/058-transactions.mdx +++ b/content/200-orm/200-prisma-client/100-queries/058-transactions.mdx @@ -1087,6 +1087,7 @@ const numTeammates = await prisma.user.count({ }, }) +//highlight-start // Find customer in Stripe let customer = await stripe.customers.get({ externalId: teamID }) @@ -1096,6 +1097,7 @@ if (customer) { externalId: teamId, plan: 'plan_id', quantity: numTeammates, +//highlight-end }) } else { customer = await stripe.customers.create({ @@ -1242,6 +1244,7 @@ if (!availableSeat) { throw new Error(`Oh no! ${movieName} is all booked.`) } +//highlight-start // Only mark the seat as claimed if the availableSeat.version // matches the version we're updating. Additionally, increment the // version when we perform this update so all other clients trying @@ -1262,6 +1265,7 @@ const seats = await client.seat.updateMany({ if (seats.count === 0) { throw new Error(`That seat is already booked! Please try again.`) } +//highlight-end ``` It is now impossible for two people to book the same seat: diff --git a/content/200-orm/200-prisma-client/100-queries/060-full-text-search.mdx b/content/200-orm/200-prisma-client/100-queries/060-full-text-search.mdx index 605ff4ed9e..76f070a666 100644 --- a/content/200-orm/200-prisma-client/100-queries/060-full-text-search.mdx +++ b/content/200-orm/200-prisma-client/100-queries/060-full-text-search.mdx @@ -31,6 +31,7 @@ The full-text search API is currently a Preview feature. To enable this feature, ```prisma file=schema.prisma highlight=3;add showLineNumbers generator client { provider = "prisma-client-js" + //add-next-line previewFeatures = ["fullTextSearch", "fullTextIndex"] } ``` diff --git a/content/200-orm/200-prisma-client/500-deployment/201-serverless/400-deploy-to-aws-lambda.mdx b/content/200-orm/200-prisma-client/500-deployment/201-serverless/400-deploy-to-aws-lambda.mdx index f361dfcf0b..95e0af9879 100644 --- a/content/200-orm/200-prisma-client/500-deployment/201-serverless/400-deploy-to-aws-lambda.mdx +++ b/content/200-orm/200-prisma-client/500-deployment/201-serverless/400-deploy-to-aws-lambda.mdx @@ -66,7 +66,7 @@ While we do not recommend running migrations within AWS Lambda, some application In the case of AWS lambda, you will have to add the following environment variable: -```env file=.env +```env file=.env showLineNumbers PRISMA_CLI_BINARY_TARGETS=native,rhel-openssl-1.0.x ``` @@ -92,7 +92,7 @@ AWS SAM uses [esbuild](https://esbuild.github.io/) to bundle your TypeScript cod To get around this, you need to directly reference the needed files in your code to bundle them correctly. In your application, you could add the following lines to your application where Prisma ORM is instantiated. -```ts file=app.ts +```ts file=app.ts showLineNumbers import schema from './prisma/schema.prisma' import x from './node_modules/.prisma/client/libquery_engine-rhel-openssl-1.0.x.so.node' @@ -103,7 +103,7 @@ if (process.env.NODE_ENV !== 'production') { You will also need to define how to bundle these files with esbuild by adding the following lines to `Metadata.BuildProperties` in your `template.yaml`: -```yaml file=template.yaml +```yaml file=template.yaml showLineNumbers Loader: - .prisma=file - .so.node=file @@ -126,7 +126,7 @@ npm install -D serverless-dotenv-plugin Then, add `serverless-dotenv-plugin` to your list of plugins in `serverless.yml`: -```code file=serverless.yml no-copy +```code file=serverless.yml no-copy showLineNumbers plugins: - serverless-dotenv-plugin ``` @@ -161,7 +161,7 @@ Packaging deployment-example-sls for stage dev (us-east-1) To reduce your deployment footprint, you can update your deployment process to only upload the files your application needs. The Serverless configuration file, `serverless.yml`, below shows a `package` pattern that includes only the Prisma ORM engine file relevant to the Lambda runtime and excludes the others. This means that when Serverless Framework packages your app for upload, it includes only one engine file. This ensures the packaged archive is as small as possible. -```code file=serverless.yml no-copy +```code file=serverless.yml no-copy showLineNumbers package: patterns: - '!node_modules/.prisma/client/libquery_engine-*' @@ -172,10 +172,11 @@ package: If you are deploying to [Lambda functions with ARM64 architecture](#lambda-functions-with-arm64-architectures) you should update the Serverless configuration file to package the `arm64` engine file, as follows: -```code file=serverless.yml highlight=4;normal +```code file=serverless.yml highlight=4;normal showLineNumbers package: patterns: - '!node_modules/.prisma/client/libquery_engine-*' + //highlight-next-line - 'node_modules/.prisma/client/libquery_engine-linux-arm64-*' - '!node_modules/prisma/libquery_engine-*' - '!node_modules/@prisma/engines/**' @@ -203,11 +204,12 @@ npm install --save-dev webpack webpack-node-externals copy-webpack-plugin server In your `webpack.config.js`, make sure that you set `externals` to `nodeExternals()` like the following: -```javascript file=webpack.config.js highlight=1,5;normal; +```javascript file=webpack.config.js highlight=1,5;normal; showLineNumbers const nodeExternals = require('webpack-node-externals') module.exports = { // ... other configuration + //highlight-next-line externals: [nodeExternals()], // ... other configuration } @@ -215,13 +217,15 @@ module.exports = { Update the `plugins` property in your `webpack.config.js` file to include the `copy-webpack-plugin`: -```javascript file=webpack.config.js highlight=2,7-13;normal; +```javascript file=webpack.config.js highlight=2,7-13;normal; showLineNumbers const nodeExternals = require('webpack-node-externals') +//highlight-next-line const CopyPlugin = require('copy-webpack-plugin') module.exports = { // ... other configuration externals: [nodeExternals()], + //highlight-start plugins: [ new CopyPlugin({ patterns: [ @@ -229,6 +233,7 @@ module.exports = { ], }), ], + //highlight-end // ... other configuration } ``` @@ -247,7 +252,7 @@ Refer to the [Serverless Webpack documentation](https://www.serverless.com/plugi In your `serverless.yml` file, make sure that the `custom > webpack` block has `prisma generate` under `packagerOptions > scripts` as follows: -```yaml file=serverless.yml +```yaml file=serverless.yml showLineNumbers custom: webpack: packagerOptions: @@ -324,7 +329,7 @@ While SST supports `.env` files, [it is not recommended](https://docs.sst.dev/co The SST guide [available here](https://docs.sst.dev/config#overview) is a step-by-step guide to get started with `Config`. Assuming you have created a new secret called `DATABASE_URL` and have [bound that secret to your app](https://docs.sst.dev/config#bind-the-config), you can set up `PrismaClient` with the following: -```ts file=prisma.ts +```ts file=prisma.ts showLineNumbers import { PrismaClient } from '@prisma/client' import { Config } from 'sst/node/config' diff --git a/content/200-orm/200-prisma-client/500-deployment/201-serverless/500-deploy-to-netlify.mdx b/content/200-orm/200-prisma-client/500-deployment/201-serverless/500-deploy-to-netlify.mdx index db0e516487..1f6d0c5dc2 100644 --- a/content/200-orm/200-prisma-client/500-deployment/201-serverless/500-deploy-to-netlify.mdx +++ b/content/200-orm/200-prisma-client/500-deployment/201-serverless/500-deploy-to-netlify.mdx @@ -47,7 +47,7 @@ We recommend keeping `.env` files in your `.gitignore` in order to prevent leaka Assuming you have a file like the following: -```env file=.env +```env file=.env showLineNumbers # Connect to DB DATABASE_URL="postgresql://postgres:__PASSWORD__@__HOST__:__PORT__/__DB_NAME__" ``` diff --git a/content/200-orm/200-prisma-client/500-deployment/301-edge/450-deploy-to-cloudflare.mdx b/content/200-orm/200-prisma-client/500-deployment/301-edge/450-deploy-to-cloudflare.mdx index 3657cf5281..7fc2fa078d 100644 --- a/content/200-orm/200-prisma-client/500-deployment/301-edge/450-deploy-to-cloudflare.mdx +++ b/content/200-orm/200-prisma-client/500-deployment/301-edge/450-deploy-to-cloudflare.mdx @@ -49,13 +49,13 @@ When using your Worker in **development**, you can configure your database conne Assuming you use the `DATABASE_URL` environment variable from above, you can set it inside `.dev.vars` as follows: -```bash file=.dev.vars +```bash file=.dev.vars showLineNumbers DATABASE_URL="your-database-connection-string" ``` In the above snippet, `your-database-connection-string` is a placeholder that you need to replace with the value of your own connection string, for example: -```bash file=.dev.vars +```bash file=.dev.vars showLineNumbers DATABASE_URL="postgresql://admin:mypassword42@somehost.aws.com:5432/mydb" ``` @@ -70,7 +70,7 @@ There are several options for achieving this: dotenv -e .dev.vars -- npx prisma migrate dev ``` - Create a script in `package.json` that reads `.dev.vars` via [`dotenv`](https://www.npmjs.com/package/dotenv-cli). You can then execute `prisma` commands as follows: `npm run env -- npx prisma migrate dev`. Here's a reference for the script: - ```js file=package.json + ```js file=package.json showLineNumbers "scripts": { "env": "dotenv -e .dev.vars" } ``` - Duplicate the `DATABASE_URL` and any other relevant env vars into a new file called `.env` which can then be used by Prisma ORM. @@ -159,7 +159,7 @@ If you are running into a size issue and can't deploy your application because o First, ensure that the database connection is configured properly. In your Prisma schema, set the `url` of the `datasource` block to the `DATABASE_URL` environment variable. You also need to enable the `driverAdapters` feature flag: -```prisma file=schema.prisma +```prisma file=schema.prisma showLineNumbers generator client { provider = "prisma-client-js" previewFeatures = ["driverAdapters"] @@ -173,7 +173,7 @@ datasource db { Next, you need to set the `DATABASE_URL` environment variable to the value of your database connection string. You'll do this in a file called `.dev.vars` used by Cloudflare: -```bash file=.dev.vars +```bash file=.dev.vars showLineNumbers DATABASE_URL="postgresql://admin:mypassword42@somehost.aws.com:5432/mydb" ``` @@ -181,11 +181,12 @@ Because the Prisma CLI by default is only compatible with `.env` files, you can Add this script to your `package.json`: -```js file=package.json highlight=5;add +```js file=package.json highlight=5;add showLineNumbers { // ... "scripts": { // .... + //add-next-line "env": "dotenv -e .dev.vars" }, // ... @@ -212,7 +213,7 @@ npm install @types/pg --save-dev # if you're using TypeScript In your `wrangler.toml` file, add the following line: -```toml file=wrangler.toml +```toml file=wrangler.toml showLineNumbers node_compat = true ``` @@ -306,7 +307,7 @@ If you are using a PlanetScale database, you need to: First, ensure that the database connection is configured properly. In your Prisma schema, set the `url` of the `datasource` block to the `DATABASE_URL` environment variable. You also need to enable the `driverAdapters` feature flag: -```prisma file=schema.prisma +```prisma file=schema.prisma showLineNumbers generator client { provider = "prisma-client-js" previewFeatures = ["driverAdapters"] @@ -321,7 +322,7 @@ datasource db { Next, you need to set the `DATABASE_URL` environment variable to the value of your database connection string. You'll do this in a file called `.dev.vars` used by Cloudflare: -```bash file=.dev.vars +```bash file=.dev.vars showLineNumbers DATABASE_URL="mysql://32qxa2r7hfl3102wrccj:password@us-east.connect.psdb.cloud/demo-cf-worker-ps?sslaccept=strict" ``` @@ -329,11 +330,12 @@ Because the Prisma CLI by default is only compatible with `.env` files, you can Add this script to your `package.json`: -```js file=package.json highlight=5;add +```js file=package.json highlight=5;add showLineNumbers { // ... "scripts": { // .... + //add-next-line "env": "dotenv -e .dev.vars" }, // ... @@ -430,7 +432,7 @@ If you are using a Neon database, you need to: First, ensure that the database connection is configured properly. In your Prisma schema, set the `url` of the `datasource` block to the `DATABASE_URL` environment variable. You also need to enable the `driverAdapters` feature flag: -```prisma file=schema.prisma +```prisma file=schema.prisma showLineNumbers generator client { provider = "prisma-client-js" previewFeatures = ["driverAdapters"] @@ -444,7 +446,7 @@ datasource db { Next, you need to set the `DATABASE_URL` environment variable to the value of your database connection string. You'll do this in a file called `.dev.vars` used by Cloudflare: -```bash file=.dev.vars +```bash file=.dev.vars showLineNumbers DATABASE_URL="postgresql://janedoe:password@ep-nameless-pond-a23b1mdz.eu-central-1.aws.neon.tech/neondb?sslmode=require" ``` @@ -457,6 +459,7 @@ Add this script to your `package.json`: // ... "scripts": { // .... + //add-next-line "env": "dotenv -e .dev.vars" }, // ... diff --git a/content/200-orm/200-prisma-client/500-deployment/301-edge/485-deploy-to-vercel.mdx b/content/200-orm/200-prisma-client/500-deployment/301-edge/485-deploy-to-vercel.mdx index 1692e47509..714b6e0748 100644 --- a/content/200-orm/200-prisma-client/500-deployment/301-edge/485-deploy-to-vercel.mdx +++ b/content/200-orm/200-prisma-client/500-deployment/301-edge/485-deploy-to-vercel.mdx @@ -62,7 +62,7 @@ Alternatively, you can configure the environment variable [via the UI](https://v In your `package.json`, you should add a `"postinstall"` section as follows: -```js file=package.json +```js file=package.json showLineNumbers { // ..., "postinstall: "prisma generate" @@ -118,7 +118,7 @@ If you are using Vercel Postgres, you need to: First, ensure that the database connection is configured properly. In your Prisma schema, set the `url` of the `datasource` block to the `POSTGRES_PRISMA_URL` and the `directUrl` to the `POSTGRES_URL_NON_POOLING` environment variable. You also need to enable the `driverAdapters` feature flag: -```prisma file=schema.prisma +```prisma file=schema.prisma showLineNumbers generator client { provider = "prisma-client-js" previewFeatures = ["driverAdapters"] @@ -135,7 +135,7 @@ Next, you need to set the `POSTGRES_PRISMA_URL` and `POSTGRES_URL_NON_POOLING` e If you ran `npx prisma init`, you can use the `.env` file that was created by this command to set these: -```bash file=.env +```bash file=.env showLineNumbers POSTGRES_PRISMA_URL="postgres://user:password@host-pooler.region.postgres.vercel-storage.com:5432/name?pgbouncer=true&connect_timeout=15" POSTGRES_URL_NON_POOLING="postgres://user:password@host.region.postgres.vercel-storage.com:5432/name" ``` @@ -153,11 +153,12 @@ npm install @neondatabase/serverless Next, add a new key to the `scripts` section in your `package.json`: -```js file=package.json highlight=5;add +```js file=package.json highlight=5;add showLineNumbers { // ... "scripts": { // ... + //add-next-line "postinstall": "prisma generate" } } @@ -185,7 +186,7 @@ touch src/app/api/edge/route.ts Here is a sample code snippet that you can use to instantiate `PrismaClient` and send a query to your database in the new `app/api/edge/route.ts` file you just created: -```ts file=app/api/edge/route.ts +```ts file=app/api/edge/route.ts showLineNumbers import { NextResponse } from 'next/server' import { PrismaClient } from '@prisma/client' import { PrismaNeon } from '@prisma/adapter-neon' @@ -240,7 +241,7 @@ If you are using a PlanetScale database, you need to: First, ensure that the database connection is configured properly. In your Prisma schema, set the `url` of the `datasource` block to the `DATABASE_URL` environment variable. You also need to enable the `driverAdapters` feature flag: -```prisma file=schema.prisma +```prisma file=schema.prisma showLineNumbers generator client { provider = "prisma-client-js" previewFeatures = ["driverAdapters"] @@ -255,7 +256,7 @@ datasource db { Next, you need to set the `DATABASE_URL` environment variable in your `.env` file that's used both by Prisma and Next.js to read your env vars: -```bash file=.env +```bash file=.env showLineNumbers DATABASE_URL="mysql://32qxa2r7hfl3102wrccj:password@us-east.connect.psdb.cloud/demo-cf-worker-ps?sslaccept=strict" ``` @@ -272,11 +273,12 @@ npm install @planetscale/database Next, add a new key to the `scripts` section in your `package.json`: -```js file=package.json highlight=5;add +```js file=package.json highlight=5;add showLineNumbers { // ... "scripts": { // ... + //add-next-line "postinstall": "prisma generate" } } @@ -304,7 +306,7 @@ touch src/app/api/edge/route.ts Here is a sample code snippet that you can use to instantiate `PrismaClient` and send a query to your database in the new `app/api/edge/route.ts` file you just created: -```ts file=app/api/edge/route.ts +```ts file=app/api/edge/route.ts showLineNumbers import { NextResponse } from 'next/server' import { PrismaClient } from '@prisma/client' import { PrismaPlanetScale } from '@prisma/adapter-planetscale' @@ -359,7 +361,7 @@ If you are using a Neon database, you need to: First, ensure that the database connection is configured properly. In your Prisma schema, set the `url` of the `datasource` block to the `DATABASE_URL` environment variable. You also need to enable the `driverAdapters` feature flag: -```prisma file=schema.prisma +```prisma file=schema.prisma showLineNumbers generator client { provider = "prisma-client-js" previewFeatures = ["driverAdapters"] @@ -373,7 +375,7 @@ datasource db { Next, you need to set the `DATABASE_URL` environment variable in your `.env` file that's used both by Prisma and Next.js to read your env vars: -```bash file=.env +```bash file=.env showLineNumbers DATABASE_URL="postgresql://janedoe:password@ep-nameless-pond-a23b1mdz.eu-central-1.aws.neon.tech/neondb?sslmode=require" ``` @@ -390,11 +392,12 @@ npm install @neondatabase/serverless Next, add a new key to the `scripts` section in your `package.json`: -```js file=package.json highlight=5;add +```js file=package.json highlight=5;add showLineNumbers { // ... "scripts": { // ... + //add-next-line "postinstall": "prisma generate" } } @@ -422,7 +425,7 @@ touch src/app/api/edge/route.ts Here is a sample code snippet that you can use to instantiate `PrismaClient` and send a query to your database in the new `app/api/edge/route.ts` file you just created: -```ts file=app/api/edge/route.ts +```ts file=app/api/edge/route.ts showLineNumbers import { NextResponse } from 'next/server' import { PrismaClient } from '@prisma/client' import { PrismaNeon } from '@prisma/adapter-neon' diff --git a/content/200-orm/200-prisma-client/500-deployment/650-caveats-when-deploying-to-aws-platforms.mdx b/content/200-orm/200-prisma-client/500-deployment/650-caveats-when-deploying-to-aws-platforms.mdx index 18418f5eb0..7c1871956e 100644 --- a/content/200-orm/200-prisma-client/500-deployment/650-caveats-when-deploying-to-aws-platforms.mdx +++ b/content/200-orm/200-prisma-client/500-deployment/650-caveats-when-deploying-to-aws-platforms.mdx @@ -27,7 +27,7 @@ When deploying an app using Prisma Client to AWS Elastic Beanstalk, Prisma ORM g Because Beanstalk limits the ability to write to the filesystem in the `postinstall` hook, you need to create an [`.npmrc`](https://docs.npmjs.com/cli/v6/configuring-npm/npmrc) file in the root of your project and add the following configuration: -```config file=.npmrc +```config file=.npmrc showLineNumbers unsafe-perm=true ``` diff --git a/content/200-orm/300-prisma-migrate/200-understanding-prisma-migrate/200-shadow-database.mdx b/content/200-orm/300-prisma-migrate/200-understanding-prisma-migrate/200-shadow-database.mdx index 65351c6f95..81df8ad5fc 100644 --- a/content/200-orm/300-prisma-migrate/200-understanding-prisma-migrate/200-shadow-database.mdx +++ b/content/200-orm/300-prisma-migrate/200-understanding-prisma-migrate/200-shadow-database.mdx @@ -10,23 +10,20 @@ The shadow database is a second, _temporary_ database that is **created and dele [`migrate diff` command](/orm/reference/prisma-cli-reference#migrate-diff) also requires a shadow database when diffing against a local `migrations` directory with `--from-migrations` or `--to-migrations`. -:::info +* If your database does not allow creation and deleting of databases (e.g. in a cloud-hosted environment), you need to [create and configure the shadow database manually](#cloud-hosted-shadow-databases-must-be-created-manually). -If your database does not allow creation and deleting of databases (e.g. in a cloud-hosted environment), you need to [create and configure the shadow database manually](#cloud-hosted-shadow-databases-must-be-created-manually). -::: - -:::info + The shadow database is **not** required in production, and is not used by production-focused commands such as `prisma migrate resolve` and `prisma migrate deploy`. -::: + -:::info + A shadow database is never used for MongoDB as `migrate dev` is not used there. -::: + diff --git a/content/200-orm/800-more/450-migrating-to-prisma/01-migrate-from-typeorm.mdx b/content/200-orm/800-more/450-migrating-to-prisma/01-migrate-from-typeorm.mdx index f46aa726ed..1beb628516 100644 --- a/content/200-orm/800-more/450-migrating-to-prisma/01-migrate-from-typeorm.mdx +++ b/content/200-orm/800-more/450-migrating-to-prisma/01-migrate-from-typeorm.mdx @@ -365,7 +365,7 @@ Assume you have the following database connection details in `ormconfig.json`: The respective connection URL would look as follows in Prisma ORM:
-```env file=.env +```env file=.env showLineNumbers DATABASE_URL="postgresql://alice:myPassword42@localhost:5432/blog-typeorm" ```
@@ -373,7 +373,7 @@ DATABASE_URL="postgresql://alice:myPassword42@localhost:5432/blog-typeorm" Note that you can optionally configure the PostgreSQL [schema](https://www.postgresql.org/docs/9.1/ddl-schemas.html) by appending the `schema` argument to the connection URL:
-```env file=.env +```env file=.env showLineNumbers DATABASE_URL="postgresql://alice:myPassword42@localhost:5432/blog-typeorm?schema=myschema" ```
@@ -404,7 +404,7 @@ Assume you have the following database connection details in `ormconfig.json`: The respective connection URL would look as follows in Prisma:
-```env file=.env +```env file=.env showLineNumbers DATABASE_URL="mysql://alice:myPassword42@localhost:3306/blog-typeorm" ``` @@ -431,7 +431,7 @@ Assume you have the following database connection details in `ormconfig.json`: The respective connection URL would look as follows in Prisma:
-```env file=.env +```env file=.env showLineNumbers DATABASE_URL="sqlserver://localhost:1433;database=blog-typeorm;user=alice;password=myPassword42;trustServerCertificate=true" ``` @@ -454,7 +454,7 @@ Assume you have the following database connection details in `ormconfig.json`: The respective connection URL would look as follows in Prisma:
-```env file=.env +```env file=.env showLineNumbers DATABASE_URL="file:./blog-typeorm.db" ``` diff --git a/content/300-accelerate/200-getting-started.mdx b/content/300-accelerate/200-getting-started.mdx index 3123b56801..74fe9d8fc6 100644 --- a/content/300-accelerate/200-getting-started.mdx +++ b/content/300-accelerate/200-getting-started.mdx @@ -45,7 +45,7 @@ Most likely, as shown above, your database connection string in defined in a `.e Update that variable to use the new Accelerate connection string: -```env file=.env +```env file=.env showLineNumbers # __API_KEY__ is a unique API key that Accelerate generates and automatically assigns to a project. DATABASE_URL="prisma://accelerate.prisma-data.net/?api_key=__API_KEY__" diff --git a/content/400-pulse/200-getting-started.mdx b/content/400-pulse/200-getting-started.mdx index 6181a130f9..aa51ff606c 100644 --- a/content/400-pulse/200-getting-started.mdx +++ b/content/400-pulse/200-getting-started.mdx @@ -12,7 +12,7 @@ toc: true -💡 Prisma Pulse currently supports PostgreSQL. We'd love to hear [which databases](https://tally.so/r/wLbb8G) you would like to see supported next. +Prisma Pulse currently supports PostgreSQL. We'd love to hear [which databases](https://tally.so/r/wLbb8G) you would like to see supported next. @@ -28,7 +28,7 @@ Navigate to your Prisma Data Platform project, choose an environment, and enable > Once enabled, you'll be prompted to generate an API key that you'll use in your extended Prisma Client to authenticate requests. Store this API key in your application's `.env` file: > -> ```env file=.env +> ```env file=.env showLineNumbers > PULSE_API_KEY="your_secure_pulse_api_key" > ``` @@ -40,7 +40,7 @@ With Pulse enabled, proceed with these steps to integrate Pulse into your applic -💡 Pulse requires [Prisma Client](/orm/prisma-client) version `4.16.1` or higher and [`@prisma/extension-pulse`](https://www.npmjs.com/package/@prisma/extension-pulse) version `1.0.1` or higher +Pulse requires [Prisma Client](/orm/prisma-client) version `4.16.1` or higher and [`@prisma/extension-pulse`](https://www.npmjs.com/package/@prisma/extension-pulse) version `1.0.1` or higher @@ -63,7 +63,7 @@ const prisma = new PrismaClient().$extends( ) ``` - + You stored this API key in your .env file after [enabling Pulse](#1-enable-pulse). If needed, you can navigate to your respective project environment and generate a new API key. diff --git a/content/500-platform/60-platform-cli/index.mdx b/content/500-platform/60-platform-cli/index.mdx index 16e1697a5f..bdc5b21803 100644 --- a/content/500-platform/60-platform-cli/index.mdx +++ b/content/500-platform/60-platform-cli/index.mdx @@ -7,6 +7,8 @@ earlyaccess: true +## In this section +