From 133db47e455d023e6f6e4d71cb8c0319f30008ab Mon Sep 17 00:00:00 2001 From: carlagn Date: Thu, 4 Apr 2024 17:22:20 +0100 Subject: [PATCH] Revert "Revert "Docusaurus: fix:DA-199 update code highlighting name"" (#5811) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * Revert "Revert "Docusaurus: fix:DA-199 update code highlighting name (#5794)"…" This reverts commit 7e00317ebaef26b48c5e3c2147c3c86064415d1b. * update colors --- content/100-getting-started/01-quickstart.mdx | 16 +++--- ...-relational-databases-node-cockroachdb.mdx | 12 ---- .../110-relational-databases-node-mysql.mdx | 13 ----- ...-relational-databases-node-planetscale.mdx | 13 ----- ...0-relational-databases-node-postgresql.mdx | 13 ----- ...10-relational-databases-node-sqlserver.mdx | 13 ----- ...ional-databases-typescript-cockroachdb.mdx | 12 ---- ...-relational-databases-typescript-mysql.mdx | 13 ----- ...ional-databases-typescript-planetscale.mdx | 13 ----- ...tional-databases-typescript-postgresql.mdx | 13 ----- ...ational-databases-typescript-sqlserver.mdx | 13 ----- ...connect-your-database-node-cockroachdb.mdx | 24 +------- .../100-connect-your-database-node-mysql.mdx | 24 +------- ...connect-your-database-node-planetscale.mdx | 27 +-------- ...-connect-your-database-node-postgresql.mdx | 26 +-------- ...0-connect-your-database-node-sqlserver.mdx | 23 +------- ...t-your-database-typescript-cockroachdb.mdx | 24 +------- ...connect-your-database-typescript-mysql.mdx | 24 +------- ...t-your-database-typescript-planetscale.mdx | 30 ++-------- ...ct-your-database-typescript-postgresql.mdx | 24 +------- ...ect-your-database-typescript-sqlserver.mdx | 24 +------- ...-using-prisma-migrate-node-cockroachdb.mdx | 24 +------- .../150-using-prisma-migrate-node-mysql.mdx | 24 +------- ...-using-prisma-migrate-node-planetscale.mdx | 24 +------- ...0-using-prisma-migrate-node-postgresql.mdx | 24 +------- ...50-using-prisma-migrate-node-sqlserver.mdx | 24 +------- ...-prisma-migrate-typescript-cockroachdb.mdx | 24 +------- ...-using-prisma-migrate-typescript-mysql.mdx | 24 +------- ...-prisma-migrate-typescript-planetscale.mdx | 24 +------- ...g-prisma-migrate-typescript-postgresql.mdx | 24 +------- ...ng-prisma-migrate-typescript-sqlserver.mdx | 24 +------- ...install-prisma-client-node-cockroachdb.mdx | 22 ------- .../200-install-prisma-client-node-mysql.mdx | 21 ------- ...install-prisma-client-node-planetscale.mdx | 22 ------- ...-install-prisma-client-node-postgresql.mdx | 22 ------- ...0-install-prisma-client-node-sqlserver.mdx | 22 ------- ...l-prisma-client-typescript-cockroachdb.mdx | 22 ------- ...install-prisma-client-typescript-mysql.mdx | 21 ------- ...l-prisma-client-typescript-planetscale.mdx | 22 ------- ...ll-prisma-client-typescript-postgresql.mdx | 22 ------- ...all-prisma-client-typescript-sqlserver.mdx | 22 ------- ...querying-the-database-node-cockroachdb.mdx | 33 +++-------- .../250-querying-the-database-node-mysql.mdx | 27 ++------- ...querying-the-database-node-planetscale.mdx | 35 +++--------- ...-querying-the-database-node-postgresql.mdx | 33 +++-------- ...0-querying-the-database-node-sqlserver.mdx | 33 +++-------- ...ng-the-database-typescript-cockroachdb.mdx | 57 +++---------------- ...querying-the-database-typescript-mysql.mdx | 34 +++-------- ...ng-the-database-typescript-planetscale.mdx | 56 +++--------------- ...ing-the-database-typescript-postgresql.mdx | 34 +++-------- ...ying-the-database-typescript-sqlserver.mdx | 55 +++--------------- .../120-mongodb-node-mongodb.mdx | 13 ----- .../120-mongodb-typescript-mongodb.mdx | 13 ----- ...100-connect-your-database-node-mongodb.mdx | 24 +------- ...nnect-your-database-typescript-mongodb.mdx | 24 +------- ...reating-the-prisma-schema-node-mongodb.mdx | 24 +------- ...g-the-prisma-schema-typescript-mongodb.mdx | 23 +------- ...200-install-prisma-client-node-mongodb.mdx | 22 ------- ...stall-prisma-client-typescript-mongodb.mdx | 22 ------- ...250-querying-the-database-node-mongodb.mdx | 28 +++------ ...erying-the-database-typescript-mongodb.mdx | 35 +++--------- ...-relational-databases-node-cockroachdb.mdx | 13 ----- .../110-relational-databases-node-mysql.mdx | 13 ----- ...-relational-databases-node-planetscale.mdx | 13 ----- ...0-relational-databases-node-postgresql.mdx | 12 ---- ...10-relational-databases-node-sqlserver.mdx | 13 ----- ...ional-databases-typescript-cockroachdb.mdx | 14 ----- ...-relational-databases-typescript-mysql.mdx | 13 ----- ...ional-databases-typescript-planetscale.mdx | 13 ----- ...tional-databases-typescript-postgresql.mdx | 13 ----- ...ational-databases-typescript-sqlserver.mdx | 13 ----- ...connect-your-database-node-cockroachdb.mdx | 26 +-------- .../100-connect-your-database-node-mysql.mdx | 21 +------ ...connect-your-database-node-planetscale.mdx | 29 ++-------- ...-connect-your-database-node-postgresql.mdx | 24 +------- ...0-connect-your-database-node-sqlserver.mdx | 23 +------- ...t-your-database-typescript-cockroachdb.mdx | 27 +-------- ...connect-your-database-typescript-mysql.mdx | 27 +-------- ...t-your-database-typescript-planetscale.mdx | 30 ++-------- ...ct-your-database-typescript-postgresql.mdx | 24 +------- ...ect-your-database-typescript-sqlserver.mdx | 24 +------- .../150-introspection-node-cockroachdb.mdx | 29 ++-------- .../150-introspection-node-mysql.mdx | 30 ++-------- .../150-introspection-node-planetscale.mdx | 30 ++-------- .../150-introspection-node-postgresql.mdx | 30 ++-------- .../150-introspection-node-sqlserver.mdx | 30 ++-------- ...0-introspection-typescript-cockroachdb.mdx | 30 ++-------- .../150-introspection-typescript-mysql.mdx | 30 ++-------- ...0-introspection-typescript-planetscale.mdx | 30 ++-------- ...50-introspection-typescript-postgresql.mdx | 30 ++-------- ...150-introspection-typescript-sqlserver.mdx | 30 ++-------- ...aseline-your-database-node-cockroachdb.mdx | 22 ------- .../170-baseline-your-database-node-mysql.mdx | 22 ------- ...baseline-your-database-node-postgresql.mdx | 22 ------- ...-baseline-your-database-node-sqlserver.mdx | 22 ------- ...e-your-database-typescript-cockroachdb.mdx | 22 ------- ...aseline-your-database-typescript-mysql.mdx | 22 ------- ...ne-your-database-typescript-postgresql.mdx | 22 ------- ...ine-your-database-typescript-sqlserver.mdx | 22 ------- ...install-prisma-client-node-cockroachdb.mdx | 22 ------- .../200-install-prisma-client-node-mysql.mdx | 22 ------- ...install-prisma-client-node-planetscale.mdx | 22 ------- ...-install-prisma-client-node-postgresql.mdx | 22 ------- ...0-install-prisma-client-node-sqlserver.mdx | 22 ------- ...l-prisma-client-typescript-cockroachdb.mdx | 22 ------- ...install-prisma-client-typescript-mysql.mdx | 22 ------- ...l-prisma-client-typescript-planetscale.mdx | 22 ------- ...ll-prisma-client-typescript-postgresql.mdx | 22 ------- ...all-prisma-client-typescript-sqlserver.mdx | 22 ------- ...querying-the-database-node-cockroachdb.mdx | 22 ------- .../250-querying-the-database-node-mysql.mdx | 22 ------- ...querying-the-database-node-planetscale.mdx | 21 ------- ...-querying-the-database-node-postgresql.mdx | 22 ------- ...0-querying-the-database-node-sqlserver.mdx | 22 ------- ...ng-the-database-typescript-cockroachdb.mdx | 29 ++-------- ...querying-the-database-typescript-mysql.mdx | 30 ++-------- ...ng-the-database-typescript-planetscale.mdx | 30 ++-------- ...ing-the-database-typescript-postgresql.mdx | 30 ++-------- ...ying-the-database-typescript-sqlserver.mdx | 30 ++-------- ...75-evolve-your-schema-node-cockroachdb.mdx | 27 ++------- .../275-evolve-your-schema-node-mysql.mdx | 22 ++----- ...275-evolve-your-schema-node-postgresql.mdx | 22 ------- .../275-evolve-your-schema-node-sqlserver.mdx | 27 ++------- ...lve-your-schema-typescript-cockroachdb.mdx | 26 ++------- ...75-evolve-your-schema-typescript-mysql.mdx | 27 ++------- ...olve-your-schema-typescript-postgresql.mdx | 27 ++------- ...volve-your-schema-typescript-sqlserver.mdx | 29 ++-------- .../120-mongodb-node-mongodb.mdx | 13 ----- .../120-mongodb-typescript-mongodb.mdx | 13 ----- ...100-connect-your-database-node-mongodb.mdx | 24 +------- ...nnect-your-database-typescript-mongodb.mdx | 23 +------- .../125-introspection-node-mongodb.mdx | 29 ++-------- .../125-introspection-typescript-mongodb.mdx | 30 ++-------- ...200-install-prisma-client-node-mongodb.mdx | 22 ------- ...stall-prisma-client-typescript-mongodb.mdx | 22 ------- ...250-querying-the-database-node-mongodb.mdx | 16 ------ ...erying-the-database-typescript-mongodb.mdx | 30 ++-------- .../100-introduction/100-what-is-prisma.mdx | 2 +- .../04-is-prisma-an-orm.mdx | 2 + .../500-databases/200-database-drivers.mdx | 1 + .../500-databases/300-postgresql.mdx | 4 +- .../050-overview/500-databases/400-mysql.mdx | 4 +- .../050-overview/500-databases/500-sqlite.mdx | 8 +-- .../500-databases/600-mongodb.mdx | 18 +++--- .../500-databases/800-sql-server/index.mdx | 9 +-- .../500-databases/850-planetscale.mdx | 16 ++++-- .../500-databases/880-supabase.mdx | 7 ++- .../050-overview/500-databases/890-neon.mdx | 7 ++- .../050-overview/500-databases/900-turso.mdx | 3 + .../100-prisma-schema/10-overview/index.mdx | 1 + .../20-data-model/10-models.mdx | 51 ++++++++++++++--- .../20-relations/100-one-to-one-relations.mdx | 1 + .../20-relations/400-self-relations.mdx | 6 ++ ...-special-rules-for-referential-actions.mdx | 14 +++++ .../410-referential-actions/index.mdx | 26 ++++++--- .../20-relations/420-relation-mode.mdx | 13 +++-- .../500-troubleshooting-relations.mdx | 12 ++++ .../20-data-model/20-relations/index.mdx | 8 +++ .../20-data-model/30-indexes.mdx | 30 +++++----- .../20-data-model/40-views.mdx | 12 +++- .../20-data-model/50-database-mapping.mdx | 14 +++++ .../20-data-model/60-multi-schema.mdx | 17 ++++-- .../70-unsupported-database-features.mdx | 5 +- .../20-data-model/80-table-inheritance.mdx | 2 +- .../80-postgresql-extensions.mdx | 7 ++- .../005-introduction.mdx | 2 +- .../050-databases-connections/index.mdx | 7 ++- .../100-custom-model-and-field-names.mdx | 2 + .../100-queries/030-crud.mdx | 5 ++ .../100-queries/037-relation-queries.mdx | 9 ++- .../100-queries/050-filtering-and-sorting.mdx | 3 + .../056-aggregation-grouping-summarizing.mdx | 1 + .../100-queries/058-transactions.mdx | 8 +++ .../100-queries/060-full-text-search.mdx | 7 ++- .../100-queries/064-custom-models.mdx | 2 +- .../050-raw-queries.mdx | 1 + .../100-custom-and-type-safe-queries.mdx | 8 +++ .../100-query-optimization-performance.mdx | 4 ++ .../057-composite-types.mdx | 3 +- .../100-working-with-json-fields.mdx | 6 +- .../200-working-with-scalar-lists-arrays.mdx | 2 + ...ing-with-composite-ids-and-constraints.mdx | 2 + .../300-client-extensions/100-model.mdx | 1 + .../300-client-extensions/110-client.mdx | 1 + .../300-client-extensions/120-query.mdx | 1 + .../300-client-extensions/130-result.mdx | 1 + .../140-shared-extensions.mdx | 1 + .../100-soft-delete-middleware.mdx | 4 ++ .../300-client-extensions/index.mdx | 1 + .../400-type-safety/050-prisma-validator.mdx | 4 ++ .../830-prisma-type-system.mdx | 11 ++-- .../450-testing/100-unit-testing.mdx | 5 +- .../450-testing/150-integration-testing.mdx | 2 +- .../150-deploy-to-azure-functions.mdx | 3 +- .../201-serverless/300-deploy-to-vercel.mdx | 6 +- .../400-deploy-to-aws-lambda.mdx | 8 ++- .../450-deploy-to-cloudflare-workers.mdx | 3 +- .../301-edge/550-deploy-to-deno-deploy.mdx | 6 +- ...y-database-changes-with-prisma-migrate.mdx | 2 +- ...oy-migrations-from-a-local-environment.mdx | 4 +- .../240-metrics.mdx | 3 + .../250-opentelemetry-tracing.mdx | 5 +- .../230-handling-exceptions-and-errors.mdx | 2 +- .../050-getting-started.mdx | 5 +- .../010-mental-model.mdx | 1 + .../200-shadow-database.mdx | 2 + .../300-workflows/10-seeding.mdx | 4 +- .../300-workflows/100-team-development.mdx | 12 +++- .../120-native-database-functions.mdx | 4 +- .../20-prototyping-your-schema.mdx | 1 + .../40-customizing-migrations.mdx | 5 ++ .../300-workflows/45-data-migration.mdx | 10 +++- .../60-generating-down-migrations.mdx | 7 ++- .../70-patching-and-hotfixing.mdx | 4 +- .../100-prisma-schema-reference.mdx | 18 ++++++ .../500-reference/380-connection-urls.mdx | 14 ++--- .../700-upgrading-to-prisma-4.mdx | 6 +- .../100-named-constraints.mdx | 3 + .../150-referential-actions.mdx | 6 +- .../02-schema-incompatibilities-mysql.mdx | 51 ++++++++++------- ...02-schema-incompatibilities-postgresql.mdx | 47 +++++++++------ .../03-upgrading-the-prisma-layer-mysql.mdx | 12 ++-- ...-upgrading-the-prisma-layer-postgresql.mdx | 12 ++-- .../01-migrate-from-typeorm.mdx | 36 ++++++------ .../02-migrate-from-sequelize.mdx | 8 +-- .../03-migrate-from-mongoose.mdx | 18 +++++- .../600-vercel-caching-issue.mdx | 2 + .../700-netlify-caching-issue.mdx | 2 + .../800-check-constraints.mdx | 6 +- .../300-accelerate/200-getting-started.mdx | 3 +- content/400-pulse/400-api-reference.mdx | 1 + content/500-platform/20-concepts/index.mdx | 1 - .../20-style-guide/01-writing-style.mdx | 1 + .../20-style-guide/02-word-choice.mdx | 1 + .../03-spelling-punctuation-formatting.mdx | 2 + .../05-prisma-product-names.mdx | 1 + .../20-style-guide/06-image-guidelines.mdx | 1 + .../20-style-guide/10-boilerplate-content.mdx | 1 + .../200-prisma-docs/20-style-guide/index.mdx | 1 + .../30-docs-components/index.mdx | 1 - docusaurus.config.ts | 11 +++- src/css/custom.css | 5 +- src/css/theming.css | 5 +- .../CodeBlock/Container/styles.module.scss | 1 + src/theme/CodeBlock/Line/index.tsx | 2 +- src/theme/CodeBlock/Line/styles.module.css | 24 ++++---- src/theme/TabItem/index.tsx | 2 +- 247 files changed, 861 insertions(+), 3189 deletions(-) diff --git a/content/100-getting-started/01-quickstart.mdx b/content/100-getting-started/01-quickstart.mdx index 74ed41b245..79736b22b2 100644 --- a/content/100-getting-started/01-quickstart.mdx +++ b/content/100-getting-started/01-quickstart.mdx @@ -154,7 +154,7 @@ import { PrismaClient } from '@prisma/client' const prisma = new PrismaClient() async function main() { - // highlight-start + // add-start const user = await prisma.user.create({ data: { name: 'Alice', @@ -162,7 +162,7 @@ async function main() { }, }) console.log(user) - // highlight-end + // add-end } main() @@ -210,10 +210,10 @@ import { PrismaClient } from '@prisma/client' const prisma = new PrismaClient() async function main() { - // highlight-start + // add-start const users = await prisma.user.findMany() console.log(users) - // highlight-end + // add-end } main() @@ -263,7 +263,7 @@ import { PrismaClient } from '@prisma/client' const prisma = new PrismaClient() async function main() { - // highlight-start + // add-start const user = await prisma.user.create({ data: { name: 'Bob', @@ -276,7 +276,7 @@ async function main() { }, }) console.log(user) - // highlight-end + // add-end } main() @@ -322,14 +322,14 @@ import { PrismaClient } from '@prisma/client' const prisma = new PrismaClient() async function main() { -// highlight-start +// add-start const usersWithPosts = await prisma.user.findMany({ include: { posts: true, }, }) console.dir(usersWithPosts, { depth: null }) - // highlight-end + // add-end } main() diff --git a/content/100-getting-started/02-setup-prisma/100-start-from-scratch/110-relational-databases-node-cockroachdb.mdx b/content/100-getting-started/02-setup-prisma/100-start-from-scratch/110-relational-databases-node-cockroachdb.mdx index 00bb760dcf..e5c5303236 100644 --- a/content/100-getting-started/02-setup-prisma/100-start-from-scratch/110-relational-databases-node-cockroachdb.mdx +++ b/content/100-getting-started/02-setup-prisma/100-start-from-scratch/110-relational-databases-node-cockroachdb.mdx @@ -50,15 +50,3 @@ npm install prisma --save-dev This creates a `package.json` with an initial setup for a Node.js app. - - - - Connect your database - - - diff --git a/content/100-getting-started/02-setup-prisma/100-start-from-scratch/110-relational-databases-node-mysql.mdx b/content/100-getting-started/02-setup-prisma/100-start-from-scratch/110-relational-databases-node-mysql.mdx index 42077a32f9..c7eaab65d9 100644 --- a/content/100-getting-started/02-setup-prisma/100-start-from-scratch/110-relational-databases-node-mysql.mdx +++ b/content/100-getting-started/02-setup-prisma/100-start-from-scratch/110-relational-databases-node-mysql.mdx @@ -73,16 +73,3 @@ This command does two things: - creates a new directory called `prisma` that contains a file called `schema.prisma`, which contains the Prisma schema with your database connection variable and schema models - creates the [`.env` file](/orm/more/development-environment/environment-variables/env-files) in the root directory of the project, which is used for defining environment variables (such as your database connection) - - - - - Connect your database - - - diff --git a/content/100-getting-started/02-setup-prisma/100-start-from-scratch/110-relational-databases-node-planetscale.mdx b/content/100-getting-started/02-setup-prisma/100-start-from-scratch/110-relational-databases-node-planetscale.mdx index 429646b354..9df70e4bad 100644 --- a/content/100-getting-started/02-setup-prisma/100-start-from-scratch/110-relational-databases-node-planetscale.mdx +++ b/content/100-getting-started/02-setup-prisma/100-start-from-scratch/110-relational-databases-node-planetscale.mdx @@ -65,16 +65,3 @@ This command does two things: - creates a new directory called `prisma` that contains a file called `schema.prisma`, which contains the Prisma schema with your database connection variable and schema models - creates the [`.env` file](/orm/more/development-environment/environment-variables/env-files) in the root directory of the project, which is used for defining environment variables (such as your database connection) - - - - - Connect your database - - - diff --git a/content/100-getting-started/02-setup-prisma/100-start-from-scratch/110-relational-databases-node-postgresql.mdx b/content/100-getting-started/02-setup-prisma/100-start-from-scratch/110-relational-databases-node-postgresql.mdx index 6ed30008c2..0af9b49876 100644 --- a/content/100-getting-started/02-setup-prisma/100-start-from-scratch/110-relational-databases-node-postgresql.mdx +++ b/content/100-getting-started/02-setup-prisma/100-start-from-scratch/110-relational-databases-node-postgresql.mdx @@ -72,16 +72,3 @@ This command does two things: - creates a new directory called `prisma` that contains a file called `schema.prisma`, which contains the Prisma schema with your database connection variable and schema models - creates the [`.env` file](/orm/more/development-environment/environment-variables/env-files) in the root directory of the project, which is used for defining environment variables (such as your database connection) - - - - - Connect your database - - - diff --git a/content/100-getting-started/02-setup-prisma/100-start-from-scratch/110-relational-databases-node-sqlserver.mdx b/content/100-getting-started/02-setup-prisma/100-start-from-scratch/110-relational-databases-node-sqlserver.mdx index 7691502cd3..1238c5b813 100644 --- a/content/100-getting-started/02-setup-prisma/100-start-from-scratch/110-relational-databases-node-sqlserver.mdx +++ b/content/100-getting-started/02-setup-prisma/100-start-from-scratch/110-relational-databases-node-sqlserver.mdx @@ -75,16 +75,3 @@ This command does two things: - creates a new directory called `prisma` that contains a file called `schema.prisma`, which contains the Prisma schema with your database connection variable and schema models - creates the [`.env` file](/orm/more/development-environment/environment-variables/env-files) in the root directory of the project, which is used for defining environment variables (such as your database connection) - - - - - Connect your database - - - diff --git a/content/100-getting-started/02-setup-prisma/100-start-from-scratch/110-relational-databases-typescript-cockroachdb.mdx b/content/100-getting-started/02-setup-prisma/100-start-from-scratch/110-relational-databases-typescript-cockroachdb.mdx index 5185fcdc7c..684f7deda6 100644 --- a/content/100-getting-started/02-setup-prisma/100-start-from-scratch/110-relational-databases-typescript-cockroachdb.mdx +++ b/content/100-getting-started/02-setup-prisma/100-start-from-scratch/110-relational-databases-typescript-cockroachdb.mdx @@ -78,15 +78,3 @@ This command does two things: - creates a new directory called `prisma` that contains a file called `schema.prisma`, which contains the Prisma schema with your database connection variable and schema models - creates the [`.env` file](/orm/more/development-environment/environment-variables/env-files) in the root directory of the project, which is used for defining environment variables (such as your database connection) - - - - Connect your database - - - diff --git a/content/100-getting-started/02-setup-prisma/100-start-from-scratch/110-relational-databases-typescript-mysql.mdx b/content/100-getting-started/02-setup-prisma/100-start-from-scratch/110-relational-databases-typescript-mysql.mdx index f95248d983..0b97c35a7b 100644 --- a/content/100-getting-started/02-setup-prisma/100-start-from-scratch/110-relational-databases-typescript-mysql.mdx +++ b/content/100-getting-started/02-setup-prisma/100-start-from-scratch/110-relational-databases-typescript-mysql.mdx @@ -78,16 +78,3 @@ This command does two things: - creates a new directory called `prisma` that contains a file called `schema.prisma`, which contains the Prisma schema with your database connection variable and schema models - creates the [`.env` file](/orm/more/development-environment/environment-variables/env-files) in the root directory of the project, which is used for defining environment variables (such as your database connection) - - - - - Connect your database - - - diff --git a/content/100-getting-started/02-setup-prisma/100-start-from-scratch/110-relational-databases-typescript-planetscale.mdx b/content/100-getting-started/02-setup-prisma/100-start-from-scratch/110-relational-databases-typescript-planetscale.mdx index 6fbc13c06f..adc567a7ad 100644 --- a/content/100-getting-started/02-setup-prisma/100-start-from-scratch/110-relational-databases-typescript-planetscale.mdx +++ b/content/100-getting-started/02-setup-prisma/100-start-from-scratch/110-relational-databases-typescript-planetscale.mdx @@ -84,16 +84,3 @@ This command does two things: - creates a new directory called `prisma` that contains a file called `schema.prisma`, which contains the Prisma schema with your database connection variable and schema models - creates the [`.env` file](/orm/more/development-environment/environment-variables/env-files) in the root directory of the project, which is used for defining environment variables (such as your database connection) - - - - - Connect your database - - - diff --git a/content/100-getting-started/02-setup-prisma/100-start-from-scratch/110-relational-databases-typescript-postgresql.mdx b/content/100-getting-started/02-setup-prisma/100-start-from-scratch/110-relational-databases-typescript-postgresql.mdx index 7346a2d127..e6a296c5c4 100644 --- a/content/100-getting-started/02-setup-prisma/100-start-from-scratch/110-relational-databases-typescript-postgresql.mdx +++ b/content/100-getting-started/02-setup-prisma/100-start-from-scratch/110-relational-databases-typescript-postgresql.mdx @@ -77,16 +77,3 @@ This command does two things: - creates a new directory called `prisma` that contains a file called `schema.prisma`, which contains the Prisma schema with your database connection variable and schema models - creates the [`.env` file](/orm/more/development-environment/environment-variables/env-files) in the root directory of the project, which is used for defining environment variables (such as your database connection) - - - - - Connect your database - - - diff --git a/content/100-getting-started/02-setup-prisma/100-start-from-scratch/110-relational-databases-typescript-sqlserver.mdx b/content/100-getting-started/02-setup-prisma/100-start-from-scratch/110-relational-databases-typescript-sqlserver.mdx index 23584767a5..80298bdd93 100644 --- a/content/100-getting-started/02-setup-prisma/100-start-from-scratch/110-relational-databases-typescript-sqlserver.mdx +++ b/content/100-getting-started/02-setup-prisma/100-start-from-scratch/110-relational-databases-typescript-sqlserver.mdx @@ -80,16 +80,3 @@ This command does two things: - creates a new directory called `prisma` that contains a file called `schema.prisma`, which contains the Prisma schema with your database connection variable and schema models - creates the [`.env` file](/orm/more/development-environment/environment-variables/env-files) in the root directory of the project, which is used for defining environment variables (such as your database connection) - - - - - Connect your database - - - diff --git a/content/100-getting-started/02-setup-prisma/100-start-from-scratch/110-relational-databases/100-connect-your-database-node-cockroachdb.mdx b/content/100-getting-started/02-setup-prisma/100-start-from-scratch/110-relational-databases/100-connect-your-database-node-cockroachdb.mdx index 5b02b1e6e9..9ef16be4d7 100644 --- a/content/100-getting-started/02-setup-prisma/100-start-from-scratch/110-relational-databases/100-connect-your-database-node-cockroachdb.mdx +++ b/content/100-getting-started/02-setup-prisma/100-start-from-scratch/110-relational-databases/100-connect-your-database-node-cockroachdb.mdx @@ -21,7 +21,7 @@ pagination_next: getting-started/setup-prisma/start-from-scratch/relational-data To connect your database, you need to set the `url` field of the `datasource` block in your Prisma schema to your database [connection URL](/orm/reference/connection-urls): -```prisma file=prisma/schema.prisma +```prisma file=prisma/schema.prisma showLineNumbers datasource db { provider = "postgresql" url = env("DATABASE_URL") @@ -69,25 +69,3 @@ DATABASE_URL="postgresql://root@localhost:26257?sslmode=disable" ``` Your connection string is displayed as part of the welcome text when starting CockroachDB from the command line. - - - - - Installation - - - - Using Prisma Migrate - - - diff --git a/content/100-getting-started/02-setup-prisma/100-start-from-scratch/110-relational-databases/100-connect-your-database-node-mysql.mdx b/content/100-getting-started/02-setup-prisma/100-start-from-scratch/110-relational-databases/100-connect-your-database-node-mysql.mdx index e504af145b..a1b84f6fe2 100644 --- a/content/100-getting-started/02-setup-prisma/100-start-from-scratch/110-relational-databases/100-connect-your-database-node-mysql.mdx +++ b/content/100-getting-started/02-setup-prisma/100-start-from-scratch/110-relational-databases/100-connect-your-database-node-mysql.mdx @@ -21,7 +21,7 @@ pagination_next: getting-started/setup-prisma/start-from-scratch/relational-data To connect your database, you need to set the `url` field of the `datasource` block in your Prisma schema to your database [connection URL](/orm/reference/connection-urls): -```prisma file=prisma/schema.prisma +```prisma file=prisma/schema.prisma showLineNumbers datasource db { provider = "postgresql" url = env("DATABASE_URL") @@ -76,25 +76,3 @@ When running MySQL locally, your connection URL typically looks similar to this: ```bash file=.env DATABASE_URL="mysql://root:randompassword@localhost:3306/mydb" ``` - - - - - Installation - - - - Using Prisma Migrate - - - diff --git a/content/100-getting-started/02-setup-prisma/100-start-from-scratch/110-relational-databases/100-connect-your-database-node-planetscale.mdx b/content/100-getting-started/02-setup-prisma/100-start-from-scratch/110-relational-databases/100-connect-your-database-node-planetscale.mdx index 28bf68dd47..41a98ad7d2 100644 --- a/content/100-getting-started/02-setup-prisma/100-start-from-scratch/110-relational-databases/100-connect-your-database-node-planetscale.mdx +++ b/content/100-getting-started/02-setup-prisma/100-start-from-scratch/110-relational-databases/100-connect-your-database-node-planetscale.mdx @@ -21,7 +21,7 @@ pagination_next: getting-started/setup-prisma/start-from-scratch/relational-data To connect your database, you need to set the `url` field of the `datasource` block in your Prisma schema to your database [connection URL](/orm/reference/connection-urls): -```prisma file=prisma/schema.prisma +```prisma file=prisma/schema.prisma showLineNumbers datasource db { provider = "postgresql" url = env("DATABASE_URL") @@ -44,7 +44,7 @@ You will also need to set the relation mode type to `prisma` in order to [emulat datasource db { provider = "mysql" url = env("DATABASE_URL") - //highlight-next-line + //add-next-line relationMode = "prisma" } ``` @@ -104,26 +104,3 @@ pscale connect prisma-test branchname --port PORT The `--port` flag can be omitted if you are using the default port `3306`. - - - - - Installation - - - - Creating the database schema - - - - diff --git a/content/100-getting-started/02-setup-prisma/100-start-from-scratch/110-relational-databases/100-connect-your-database-node-postgresql.mdx b/content/100-getting-started/02-setup-prisma/100-start-from-scratch/110-relational-databases/100-connect-your-database-node-postgresql.mdx index 1817fc0d39..b94ea69560 100644 --- a/content/100-getting-started/02-setup-prisma/100-start-from-scratch/110-relational-databases/100-connect-your-database-node-postgresql.mdx +++ b/content/100-getting-started/02-setup-prisma/100-start-from-scratch/110-relational-databases/100-connect-your-database-node-postgresql.mdx @@ -21,7 +21,7 @@ pagination_next: getting-started/setup-prisma/start-from-scratch/relational-data To connect your database, you need to set the `url` field of the `datasource` block in your Prisma schema to your database [connection URL](/orm/reference/connection-urls): -```prisma file=prisma/schema.prisma +```prisma file=prisma/schema.prisma showLineNumbers datasource db { provider = "postgresql" url = env("DATABASE_URL") @@ -69,26 +69,4 @@ When running PostgreSQL locally on macOS, your user and password as well as the ```bash file=.env DATABASE_URL="postgresql://janedoe:janedoe@localhost:5432/janedoe?schema=hello-prisma" -``` - - - - - Installation - - - - Using Prisma Migrate - - - +``` \ No newline at end of file diff --git a/content/100-getting-started/02-setup-prisma/100-start-from-scratch/110-relational-databases/100-connect-your-database-node-sqlserver.mdx b/content/100-getting-started/02-setup-prisma/100-start-from-scratch/110-relational-databases/100-connect-your-database-node-sqlserver.mdx index bd38f626c7..694cb32284 100644 --- a/content/100-getting-started/02-setup-prisma/100-start-from-scratch/110-relational-databases/100-connect-your-database-node-sqlserver.mdx +++ b/content/100-getting-started/02-setup-prisma/100-start-from-scratch/110-relational-databases/100-connect-your-database-node-sqlserver.mdx @@ -20,7 +20,7 @@ pagination_next: getting-started/setup-prisma/start-from-scratch/relational-data ## Connect your database To connect your database, you need to set the `url` field of the `datasource` block in your Prisma schema to your database [connection URL](/orm/reference/connection-urls): -```prisma file=prisma/schema.prisma +```prisma file=prisma/schema.prisma showLineNumbers datasource db { provider = "sqlserver" url = env("DATABASE_URL") @@ -45,24 +45,3 @@ Adjust the connection URL to match your setup - see [Microsoft SQL Server connec > Make sure TCP/IP connections are enabled via [SQL Server Configuration Manager](https://docs.microsoft.com/en-us/sql/relational-databases/sql-server-configuration-manager) to avoid `No connection could be made because the target machine actively refused it. (os error 10061)` - - - - Installation - - - - Using Prisma Migrate - - - diff --git a/content/100-getting-started/02-setup-prisma/100-start-from-scratch/110-relational-databases/100-connect-your-database-typescript-cockroachdb.mdx b/content/100-getting-started/02-setup-prisma/100-start-from-scratch/110-relational-databases/100-connect-your-database-typescript-cockroachdb.mdx index 7d56f86be7..71fc1cec0b 100644 --- a/content/100-getting-started/02-setup-prisma/100-start-from-scratch/110-relational-databases/100-connect-your-database-typescript-cockroachdb.mdx +++ b/content/100-getting-started/02-setup-prisma/100-start-from-scratch/110-relational-databases/100-connect-your-database-typescript-cockroachdb.mdx @@ -21,7 +21,7 @@ pagination_next: getting-started/setup-prisma/start-from-scratch/relational-data To connect your database, you need to set the `url` field of the `datasource` block in your Prisma schema to your database [connection URL](/orm/reference/connection-urls): -```prisma file=prisma/schema.prisma +```prisma file=prisma/schema.prisma showLineNumbers datasource db { provider = "postgresql" url = env("DATABASE_URL") @@ -69,25 +69,3 @@ DATABASE_URL="postgresql://root@localhost:26257?sslmode=disable" ``` Your connection string is displayed as part of the welcome text when starting CockroachDB from the command line. - - - - - Installation - - - - Using Prisma Migrate - - - diff --git a/content/100-getting-started/02-setup-prisma/100-start-from-scratch/110-relational-databases/100-connect-your-database-typescript-mysql.mdx b/content/100-getting-started/02-setup-prisma/100-start-from-scratch/110-relational-databases/100-connect-your-database-typescript-mysql.mdx index 6f830685f9..9763de242b 100644 --- a/content/100-getting-started/02-setup-prisma/100-start-from-scratch/110-relational-databases/100-connect-your-database-typescript-mysql.mdx +++ b/content/100-getting-started/02-setup-prisma/100-start-from-scratch/110-relational-databases/100-connect-your-database-typescript-mysql.mdx @@ -21,7 +21,7 @@ pagination_next: getting-started/setup-prisma/start-from-scratch/relational-data To connect your database, you need to set the `url` field of the `datasource` block in your Prisma schema to your database [connection URL](/orm/reference/connection-urls): -```prisma file=prisma/schema.prisma +```prisma file=prisma/schema.prisma showLineNumbers datasource db { provider = "postgresql" url = env("DATABASE_URL") @@ -76,25 +76,3 @@ When running MySQL locally, your connection URL typically looks similar to this: ```bash file=.env DATABASE_URL="mysql://root:randompassword@localhost:3306/mydb" ``` - - - - - Installation - - - - Using Prisma Migrate - - - diff --git a/content/100-getting-started/02-setup-prisma/100-start-from-scratch/110-relational-databases/100-connect-your-database-typescript-planetscale.mdx b/content/100-getting-started/02-setup-prisma/100-start-from-scratch/110-relational-databases/100-connect-your-database-typescript-planetscale.mdx index 485922e869..d2813c717a 100644 --- a/content/100-getting-started/02-setup-prisma/100-start-from-scratch/110-relational-databases/100-connect-your-database-typescript-planetscale.mdx +++ b/content/100-getting-started/02-setup-prisma/100-start-from-scratch/110-relational-databases/100-connect-your-database-typescript-planetscale.mdx @@ -21,7 +21,7 @@ pagination_next: getting-started/setup-prisma/start-from-scratch/relational-data To connect your database, you need to set the `url` field of the `datasource` block in your Prisma schema to your database [connection URL](/orm/reference/connection-urls): -```prisma file=prisma/schema.prisma +```prisma file=prisma/schema.prisma showLineNumbers datasource db { provider = "postgresql" url = env("DATABASE_URL") @@ -30,8 +30,9 @@ datasource db { Note that the default schema created by `prisma init` uses PostgreSQL as the `provider`. For PlanetScale, you need to edit the `datasource` block to use the `mysql` provider instead: -```prisma file=prisma/schema.prisma highlight=2;edit +```prisma file=prisma/schema.prisma highlight=2;edit showLineNumbers datasource db { + //edit-next-line provider = "mysql" url = env("DATABASE_URL") } @@ -39,10 +40,11 @@ datasource db { You will also need to set the relation mode type to `prisma` in order to [emulate foreign key constraints](/orm/overview/databases/planetscale#option-1-emulate-relations-in-prisma-client) in the `datasource` block: -```prisma file=schema.prisma highlight=4;add +```prisma file=schema.prisma highlight=4;add showLineNumbers datasource db { provider = "mysql" url = env("DATABASE_URL") + //add-next-line relationMode = "prisma" } ``` @@ -102,25 +104,3 @@ pscale connect prisma-test branchname --port PORT The `--port` flag can be omitted if you are using the default port `3306`. - - - - - Installation - - - - Creating the database schema - - - diff --git a/content/100-getting-started/02-setup-prisma/100-start-from-scratch/110-relational-databases/100-connect-your-database-typescript-postgresql.mdx b/content/100-getting-started/02-setup-prisma/100-start-from-scratch/110-relational-databases/100-connect-your-database-typescript-postgresql.mdx index 26062f3c99..b8f1ee888f 100644 --- a/content/100-getting-started/02-setup-prisma/100-start-from-scratch/110-relational-databases/100-connect-your-database-typescript-postgresql.mdx +++ b/content/100-getting-started/02-setup-prisma/100-start-from-scratch/110-relational-databases/100-connect-your-database-typescript-postgresql.mdx @@ -19,7 +19,7 @@ pagination_next: getting-started/setup-prisma/start-from-scratch/relational-data To connect your database, you need to set the `url` field of the `datasource` block in your Prisma schema to your database [connection URL](/orm/reference/connection-urls): -```prisma file=prisma/schema.prisma +```prisma file=prisma/schema.prisma showLineNumbers datasource db { provider = "postgresql" url = env("DATABASE_URL") @@ -68,25 +68,3 @@ When running PostgreSQL locally on macOS, your user and password as well as the ```bash file=.env DATABASE_URL="postgresql://janedoe:janedoe@localhost:5432/janedoe?schema=hello-prisma" ``` - - - - - Installation - - - - Using Prisma Migrate - - - diff --git a/content/100-getting-started/02-setup-prisma/100-start-from-scratch/110-relational-databases/100-connect-your-database-typescript-sqlserver.mdx b/content/100-getting-started/02-setup-prisma/100-start-from-scratch/110-relational-databases/100-connect-your-database-typescript-sqlserver.mdx index 00bd27949f..bf7c6a589b 100644 --- a/content/100-getting-started/02-setup-prisma/100-start-from-scratch/110-relational-databases/100-connect-your-database-typescript-sqlserver.mdx +++ b/content/100-getting-started/02-setup-prisma/100-start-from-scratch/110-relational-databases/100-connect-your-database-typescript-sqlserver.mdx @@ -20,7 +20,7 @@ pagination_next: getting-started/setup-prisma/start-from-scratch/relational-data To connect your database, you need to set the `url` field of the `datasource` block in your Prisma schema to your database [connection URL](/orm/reference/connection-urls): -```prisma file=prisma/schema.prisma +```prisma file=prisma/schema.prisma showLineNumbers datasource db { provider = "sqlserver" url = env("DATABASE_URL") @@ -45,25 +45,3 @@ Adjust the connection URL to match your setup - see [Microsoft SQL Server connec > Make sure TCP/IP connections are enabled via [SQL Server Configuration Manager](https://docs.microsoft.com/en-us/sql/relational-databases/sql-server-configuration-manager) to avoid `No connection could be made because the target machine actively refused it. (os error 10061)` - - - - - Installation - - - - Using Prisma Migrate - - - diff --git a/content/100-getting-started/02-setup-prisma/100-start-from-scratch/110-relational-databases/150-using-prisma-migrate-node-cockroachdb.mdx b/content/100-getting-started/02-setup-prisma/100-start-from-scratch/110-relational-databases/150-using-prisma-migrate-node-cockroachdb.mdx index 210495980c..d1b1da1182 100644 --- a/content/100-getting-started/02-setup-prisma/100-start-from-scratch/110-relational-databases/150-using-prisma-migrate-node-cockroachdb.mdx +++ b/content/100-getting-started/02-setup-prisma/100-start-from-scratch/110-relational-databases/150-using-prisma-migrate-node-cockroachdb.mdx @@ -20,7 +20,7 @@ pagination_next: getting-started/setup-prisma/start-from-scratch/relational-data In this guide, you'll use [Prisma Migrate](/orm/prisma-migrate) to create the tables in your database. Add the following Prisma data model to your Prisma schema in `prisma/schema.prisma`: -```prisma file=prisma/schema.prisma copy +```prisma file=prisma/schema.prisma copy showLineNumbers model Post { id BigInt @id @default(sequence()) createdAt DateTime @default(now()) @@ -64,25 +64,3 @@ This command does two things: ::: Great, you now created three tables in your database with Prisma Migrate 🚀 - - - - - Connect your database - - - - Install Prisma Client - - - diff --git a/content/100-getting-started/02-setup-prisma/100-start-from-scratch/110-relational-databases/150-using-prisma-migrate-node-mysql.mdx b/content/100-getting-started/02-setup-prisma/100-start-from-scratch/110-relational-databases/150-using-prisma-migrate-node-mysql.mdx index 484baf1878..aaf8a67e76 100644 --- a/content/100-getting-started/02-setup-prisma/100-start-from-scratch/110-relational-databases/150-using-prisma-migrate-node-mysql.mdx +++ b/content/100-getting-started/02-setup-prisma/100-start-from-scratch/110-relational-databases/150-using-prisma-migrate-node-mysql.mdx @@ -21,7 +21,7 @@ pagination_next: getting-started/setup-prisma/start-from-scratch/relational-data In this guide, you'll use [Prisma Migrate](/orm/prisma-migrate) to create the tables in your database. Add the following Prisma data model to your Prisma schema in `prisma/schema.prisma`: -```prisma file=prisma/schema.prisma copy +```prisma file=prisma/schema.prisma copy showLineNumbers model Post { id Int @id @default(autoincrement()) createdAt DateTime @default(now()) @@ -63,25 +63,3 @@ This command does two things: > **Note**: `generate` is called under the hood by default, after running `prisma migrate dev`. If the `prisma-client-js` generator is defined in your schema, this will check if `@prisma/client` is installed and install it if it's missing. Great, you now created three tables in your database with Prisma Migrate 🚀 - - - - - Connect your database - - - - Install Prisma Client - - - diff --git a/content/100-getting-started/02-setup-prisma/100-start-from-scratch/110-relational-databases/150-using-prisma-migrate-node-planetscale.mdx b/content/100-getting-started/02-setup-prisma/100-start-from-scratch/110-relational-databases/150-using-prisma-migrate-node-planetscale.mdx index b6e490d7d4..e360769618 100644 --- a/content/100-getting-started/02-setup-prisma/100-start-from-scratch/110-relational-databases/150-using-prisma-migrate-node-planetscale.mdx +++ b/content/100-getting-started/02-setup-prisma/100-start-from-scratch/110-relational-databases/150-using-prisma-migrate-node-planetscale.mdx @@ -20,7 +20,7 @@ pagination_next: getting-started/setup-prisma/start-from-scratch/relational-data In this guide, you'll use Prisma's [`db push` command](/orm/prisma-migrate/workflows/prototyping-your-schema) to create the tables in your database. Add the following Prisma data model to your Prisma schema in `prisma/schema.prisma`: -```prisma file=prisma/schema.prisma copy +```prisma file=prisma/schema.prisma copy showLineNumbers model Post { id Int @id @default(autoincrement()) createdAt DateTime @default(now()) @@ -61,25 +61,3 @@ npx prisma db push ``` Great, you now created three tables in your database with Prisma's `db push` command 🚀 - - - - - Connect your database - - - - Install Prisma Client - - - diff --git a/content/100-getting-started/02-setup-prisma/100-start-from-scratch/110-relational-databases/150-using-prisma-migrate-node-postgresql.mdx b/content/100-getting-started/02-setup-prisma/100-start-from-scratch/110-relational-databases/150-using-prisma-migrate-node-postgresql.mdx index d31a36bcc3..fa19622a5d 100644 --- a/content/100-getting-started/02-setup-prisma/100-start-from-scratch/110-relational-databases/150-using-prisma-migrate-node-postgresql.mdx +++ b/content/100-getting-started/02-setup-prisma/100-start-from-scratch/110-relational-databases/150-using-prisma-migrate-node-postgresql.mdx @@ -20,7 +20,7 @@ pagination_next: getting-started/setup-prisma/start-from-scratch/relational-data In this guide, you'll use [Prisma Migrate](/orm/prisma-migrate) to create the tables in your database. Add the following data model to your [Prisma schema](/orm/prisma-schema) in `prisma/schema.prisma`: -```prisma file=prisma/schema.prisma +```prisma file=prisma/schema.prisma showLineNumbers model Post { id Int @id @default(autoincrement()) createdAt DateTime @default(now()) @@ -64,25 +64,3 @@ This command does two things: ::: Great, you now created three tables in your database with Prisma Migrate 🚀 - - - - - Connect your database - - - - Install Prisma Client - - - diff --git a/content/100-getting-started/02-setup-prisma/100-start-from-scratch/110-relational-databases/150-using-prisma-migrate-node-sqlserver.mdx b/content/100-getting-started/02-setup-prisma/100-start-from-scratch/110-relational-databases/150-using-prisma-migrate-node-sqlserver.mdx index 79231ef6b6..38ebccb4be 100644 --- a/content/100-getting-started/02-setup-prisma/100-start-from-scratch/110-relational-databases/150-using-prisma-migrate-node-sqlserver.mdx +++ b/content/100-getting-started/02-setup-prisma/100-start-from-scratch/110-relational-databases/150-using-prisma-migrate-node-sqlserver.mdx @@ -20,7 +20,7 @@ pagination_next: getting-started/setup-prisma/start-from-scratch/relational-data In this guide, you'll use [Prisma Migrate](/orm/prisma-migrate) to create the tables in your database. Add the following Prisma data model to your Prisma schema in `prisma/schema.prisma`: -```prisma file=prisma/schema.prisma copy +```prisma file=prisma/schema.prisma copy showLineNumbers model Post { id Int @id @default(autoincrement()) createdAt DateTime @default(now()) @@ -62,25 +62,3 @@ This command does two things: > **Note**: `generate` is called under the hood by default, after running `prisma migrate dev`. If the `prisma-client-js` generator is defined in your schema, this will check if `@prisma/client` is installed and install it if it's missing. Great, you now created three tables in your database with Prisma Migrate 🚀 - - - - - Connect your database - - - - Install Prisma Client - - - diff --git a/content/100-getting-started/02-setup-prisma/100-start-from-scratch/110-relational-databases/150-using-prisma-migrate-typescript-cockroachdb.mdx b/content/100-getting-started/02-setup-prisma/100-start-from-scratch/110-relational-databases/150-using-prisma-migrate-typescript-cockroachdb.mdx index 167f0cc667..07106fc469 100644 --- a/content/100-getting-started/02-setup-prisma/100-start-from-scratch/110-relational-databases/150-using-prisma-migrate-typescript-cockroachdb.mdx +++ b/content/100-getting-started/02-setup-prisma/100-start-from-scratch/110-relational-databases/150-using-prisma-migrate-typescript-cockroachdb.mdx @@ -20,7 +20,7 @@ pagination_next: getting-started/setup-prisma/start-from-scratch/relational-data In this guide, you'll use [Prisma Migrate](/orm/prisma-migrate) to create the tables in your database. Add the following Prisma data model to your Prisma schema in `prisma/schema.prisma`: -```prisma file=prisma/schema.prisma copy +```prisma file=prisma/schema.prisma copy showLineNumbers model Post { id BigInt @id @default(sequence()) createdAt DateTime @default(now()) @@ -64,25 +64,3 @@ This command does two things: ::: Great, you now created three tables in your database with Prisma Migrate 🚀 - - - - - Connect your database - - - - Install Prisma Client - - - diff --git a/content/100-getting-started/02-setup-prisma/100-start-from-scratch/110-relational-databases/150-using-prisma-migrate-typescript-mysql.mdx b/content/100-getting-started/02-setup-prisma/100-start-from-scratch/110-relational-databases/150-using-prisma-migrate-typescript-mysql.mdx index f35a855f8f..7ccbda5ebf 100644 --- a/content/100-getting-started/02-setup-prisma/100-start-from-scratch/110-relational-databases/150-using-prisma-migrate-typescript-mysql.mdx +++ b/content/100-getting-started/02-setup-prisma/100-start-from-scratch/110-relational-databases/150-using-prisma-migrate-typescript-mysql.mdx @@ -20,7 +20,7 @@ pagination_next: getting-started/setup-prisma/start-from-scratch/relational-data In this guide, you'll use [Prisma Migrate](/orm/prisma-migrate) to create the tables in your database. Add the following Prisma data model to your Prisma schema in `prisma/schema.prisma`: -```prisma file=prisma/schema.prisma copy +```prisma file=prisma/schema.prisma copy showLineNumbers model Post { id Int @id @default(autoincrement()) createdAt DateTime @default(now()) @@ -62,25 +62,3 @@ This command does two things: > **Note**: `generate` is called under the hood by default, after running `prisma migrate dev`. If the `prisma-client-js` generator is defined in your schema, this will check if `@prisma/client` is installed and install it if it's missing. Great, you now created three tables in your database with Prisma Migrate 🚀 - - - - - Connect your database - - - - Install Prisma Client - - - diff --git a/content/100-getting-started/02-setup-prisma/100-start-from-scratch/110-relational-databases/150-using-prisma-migrate-typescript-planetscale.mdx b/content/100-getting-started/02-setup-prisma/100-start-from-scratch/110-relational-databases/150-using-prisma-migrate-typescript-planetscale.mdx index 5d7346fbb4..937ab9f84b 100644 --- a/content/100-getting-started/02-setup-prisma/100-start-from-scratch/110-relational-databases/150-using-prisma-migrate-typescript-planetscale.mdx +++ b/content/100-getting-started/02-setup-prisma/100-start-from-scratch/110-relational-databases/150-using-prisma-migrate-typescript-planetscale.mdx @@ -20,7 +20,7 @@ pagination_next: getting-started/setup-prisma/start-from-scratch/relational-data In this guide, you'll use Prisma's [`db push` command](/orm/prisma-migrate/workflows/prototyping-your-schema) to create the tables in your database. Add the following Prisma data model to your Prisma schema in `prisma/schema.prisma`: -```prisma file=prisma/schema.prisma copy +```prisma file=prisma/schema.prisma copy showLineNumbers model Post { id Int @id @default(autoincrement()) createdAt DateTime @default(now()) @@ -61,25 +61,3 @@ npx prisma db push ``` Great, you now created three tables in your database with Prisma's `db push` command 🚀 - - - - - Connect your database - - - - Install Prisma Client - - - diff --git a/content/100-getting-started/02-setup-prisma/100-start-from-scratch/110-relational-databases/150-using-prisma-migrate-typescript-postgresql.mdx b/content/100-getting-started/02-setup-prisma/100-start-from-scratch/110-relational-databases/150-using-prisma-migrate-typescript-postgresql.mdx index 1cbca4807a..bbf2012726 100644 --- a/content/100-getting-started/02-setup-prisma/100-start-from-scratch/110-relational-databases/150-using-prisma-migrate-typescript-postgresql.mdx +++ b/content/100-getting-started/02-setup-prisma/100-start-from-scratch/110-relational-databases/150-using-prisma-migrate-typescript-postgresql.mdx @@ -19,7 +19,7 @@ pagination_next: getting-started/setup-prisma/start-from-scratch/relational-data In this guide, you'll use [Prisma Migrate](/orm/prisma-migrate) to create the tables in your database. Add the following data model to your [Prisma schema](/orm/prisma-schema) in `prisma/schema.prisma`: -```prisma file=prisma/schema.prisma +```prisma file=prisma/schema.prisma showLineNumbers model Post { id Int @id @default(autoincrement()) createdAt DateTime @default(now()) @@ -63,25 +63,3 @@ This command does two things: ::: Great, you now created three tables in your database with Prisma Migrate 🚀 - - - - - Connect your database - - - - Install Prisma Client - - - diff --git a/content/100-getting-started/02-setup-prisma/100-start-from-scratch/110-relational-databases/150-using-prisma-migrate-typescript-sqlserver.mdx b/content/100-getting-started/02-setup-prisma/100-start-from-scratch/110-relational-databases/150-using-prisma-migrate-typescript-sqlserver.mdx index 54d0279ca9..24b3a62f89 100644 --- a/content/100-getting-started/02-setup-prisma/100-start-from-scratch/110-relational-databases/150-using-prisma-migrate-typescript-sqlserver.mdx +++ b/content/100-getting-started/02-setup-prisma/100-start-from-scratch/110-relational-databases/150-using-prisma-migrate-typescript-sqlserver.mdx @@ -20,7 +20,7 @@ pagination_next: getting-started/setup-prisma/start-from-scratch/relational-data In this guide, you'll use [Prisma Migrate](/orm/prisma-migrate) to create the tables in your database. Add the following Prisma data model to your Prisma schema in `prisma/schema.prisma`: -```prisma file=prisma/schema.prisma copy +```prisma file=prisma/schema.prisma copy showLineNumbers model Post { id Int @id @default(autoincrement()) createdAt DateTime @default(now()) @@ -62,25 +62,3 @@ This command does two things: > **Note**: `generate` is called under the hood by default, after running `prisma migrate dev`. If the `prisma-client-js` generator is defined in your schema, this will check if `@prisma/client` is installed and install it if it's missing. Great, you now created three tables in your database with Prisma Migrate 🚀 - - - - - Connect your database - - - - Install Prisma Client - - - diff --git a/content/100-getting-started/02-setup-prisma/100-start-from-scratch/110-relational-databases/200-install-prisma-client-node-cockroachdb.mdx b/content/100-getting-started/02-setup-prisma/100-start-from-scratch/110-relational-databases/200-install-prisma-client-node-cockroachdb.mdx index 2e965b2a51..569e44d131 100644 --- a/content/100-getting-started/02-setup-prisma/100-start-from-scratch/110-relational-databases/200-install-prisma-client-node-cockroachdb.mdx +++ b/content/100-getting-started/02-setup-prisma/100-start-from-scratch/110-relational-databases/200-install-prisma-client-node-cockroachdb.mdx @@ -29,25 +29,3 @@ The install command invokes `prisma generate` for you which reads your Prisma sc ![Install and generate Prisma Client](/img/getting-started/prisma-client-install-and-generate.png) Whenever you update your Prisma schema, you will have to update your database schema using either `prisma migrate dev` or `prisma db push`. This will keep your database schema in sync with your Prisma schema. The commands will also regenerate Prisma Client. - - - - - Using Prisma Migrate - - - - Querying the database - - - diff --git a/content/100-getting-started/02-setup-prisma/100-start-from-scratch/110-relational-databases/200-install-prisma-client-node-mysql.mdx b/content/100-getting-started/02-setup-prisma/100-start-from-scratch/110-relational-databases/200-install-prisma-client-node-mysql.mdx index 42136dbfba..be1955d45c 100644 --- a/content/100-getting-started/02-setup-prisma/100-start-from-scratch/110-relational-databases/200-install-prisma-client-node-mysql.mdx +++ b/content/100-getting-started/02-setup-prisma/100-start-from-scratch/110-relational-databases/200-install-prisma-client-node-mysql.mdx @@ -30,24 +30,3 @@ The install command invokes `prisma generate` for you which reads your Prisma sc Whenever you update your Prisma schema, you will have to update your database schema using either `prisma migrate dev` or `prisma db push`. This will keep your database schema in sync with your Prisma schema. The commands will also regenerate Prisma Client. - - - - Using Prisma Migrate - - - - Querying the database - - - diff --git a/content/100-getting-started/02-setup-prisma/100-start-from-scratch/110-relational-databases/200-install-prisma-client-node-planetscale.mdx b/content/100-getting-started/02-setup-prisma/100-start-from-scratch/110-relational-databases/200-install-prisma-client-node-planetscale.mdx index 850420a9b0..73cc171ca9 100644 --- a/content/100-getting-started/02-setup-prisma/100-start-from-scratch/110-relational-databases/200-install-prisma-client-node-planetscale.mdx +++ b/content/100-getting-started/02-setup-prisma/100-start-from-scratch/110-relational-databases/200-install-prisma-client-node-planetscale.mdx @@ -30,25 +30,3 @@ The install command invokes `prisma generate` for you which reads your Prisma sc ![Install and generate Prisma Client](/img/getting-started/prisma-client-install-and-generate.png) Whenever you update your Prisma schema, you will have to update your database schema using either `prisma migrate dev` or `prisma db push`. This will keep your database schema in sync with your Prisma schema. The commands will also regenerate Prisma Client. - - - - - Using Prisma Migrate - - - - Querying the database - - - diff --git a/content/100-getting-started/02-setup-prisma/100-start-from-scratch/110-relational-databases/200-install-prisma-client-node-postgresql.mdx b/content/100-getting-started/02-setup-prisma/100-start-from-scratch/110-relational-databases/200-install-prisma-client-node-postgresql.mdx index 8b26685183..8d6920284a 100644 --- a/content/100-getting-started/02-setup-prisma/100-start-from-scratch/110-relational-databases/200-install-prisma-client-node-postgresql.mdx +++ b/content/100-getting-started/02-setup-prisma/100-start-from-scratch/110-relational-databases/200-install-prisma-client-node-postgresql.mdx @@ -30,25 +30,3 @@ The install command invokes `prisma generate` for you which reads your Prisma sc ![Install and generate Prisma Client](/img/getting-started/prisma-client-install-and-generate.png) Whenever you update your Prisma schema, you will have to update your database schema using either `prisma migrate dev` or `prisma db push`. This will keep your database schema in sync with your Prisma schema. The commands will also regenerate Prisma Client. - - - - - Using Prisma Migrate - - - - Querying the database - - - diff --git a/content/100-getting-started/02-setup-prisma/100-start-from-scratch/110-relational-databases/200-install-prisma-client-node-sqlserver.mdx b/content/100-getting-started/02-setup-prisma/100-start-from-scratch/110-relational-databases/200-install-prisma-client-node-sqlserver.mdx index e6b348edcb..0785440c62 100644 --- a/content/100-getting-started/02-setup-prisma/100-start-from-scratch/110-relational-databases/200-install-prisma-client-node-sqlserver.mdx +++ b/content/100-getting-started/02-setup-prisma/100-start-from-scratch/110-relational-databases/200-install-prisma-client-node-sqlserver.mdx @@ -30,25 +30,3 @@ The install command invokes `prisma generate` for you which reads your Prisma sc ![Install and generate Prisma Client](/img/getting-started/prisma-client-install-and-generate.png) Whenever you update your Prisma schema, you will have to update your database schema using either `prisma migrate dev` or `prisma db push`. This will keep your database schema in sync with your Prisma schema. The commands will also regenerate Prisma Client. - - - - - Using Prisma Migrate - - - - Querying the database - - - diff --git a/content/100-getting-started/02-setup-prisma/100-start-from-scratch/110-relational-databases/200-install-prisma-client-typescript-cockroachdb.mdx b/content/100-getting-started/02-setup-prisma/100-start-from-scratch/110-relational-databases/200-install-prisma-client-typescript-cockroachdb.mdx index 01295f010c..f606da4a8b 100644 --- a/content/100-getting-started/02-setup-prisma/100-start-from-scratch/110-relational-databases/200-install-prisma-client-typescript-cockroachdb.mdx +++ b/content/100-getting-started/02-setup-prisma/100-start-from-scratch/110-relational-databases/200-install-prisma-client-typescript-cockroachdb.mdx @@ -30,25 +30,3 @@ The install command invokes `prisma generate` for you which reads your Prisma sc ![Install and generate Prisma Client](/img/getting-started/prisma-client-install-and-generate.png) Whenever you update your Prisma schema, you will have to update your database schema using either `prisma migrate dev` or `prisma db push`. This will keep your database schema in sync with your Prisma schema. The commands will also regenerate Prisma Client. - - - - - Using Prisma Migrate - - - - Querying the database - - - diff --git a/content/100-getting-started/02-setup-prisma/100-start-from-scratch/110-relational-databases/200-install-prisma-client-typescript-mysql.mdx b/content/100-getting-started/02-setup-prisma/100-start-from-scratch/110-relational-databases/200-install-prisma-client-typescript-mysql.mdx index 1c606f2648..6865105554 100644 --- a/content/100-getting-started/02-setup-prisma/100-start-from-scratch/110-relational-databases/200-install-prisma-client-typescript-mysql.mdx +++ b/content/100-getting-started/02-setup-prisma/100-start-from-scratch/110-relational-databases/200-install-prisma-client-typescript-mysql.mdx @@ -31,24 +31,3 @@ The install command invokes `prisma generate` for you which reads your Prisma sc Whenever you update your Prisma schema, you will have to update your database schema using either `prisma migrate dev` or `prisma db push`. This will keep your database schema in sync with your Prisma schema. The commands will also regenerate Prisma Client. - - - - Using Prisma Migrate - - - - Querying the database - - - \ No newline at end of file diff --git a/content/100-getting-started/02-setup-prisma/100-start-from-scratch/110-relational-databases/200-install-prisma-client-typescript-planetscale.mdx b/content/100-getting-started/02-setup-prisma/100-start-from-scratch/110-relational-databases/200-install-prisma-client-typescript-planetscale.mdx index ac1d8b9847..48b7b875fd 100644 --- a/content/100-getting-started/02-setup-prisma/100-start-from-scratch/110-relational-databases/200-install-prisma-client-typescript-planetscale.mdx +++ b/content/100-getting-started/02-setup-prisma/100-start-from-scratch/110-relational-databases/200-install-prisma-client-typescript-planetscale.mdx @@ -30,25 +30,3 @@ The install command invokes `prisma generate` for you which reads your Prisma sc ![Install and generate Prisma Client](/img/getting-started/prisma-client-install-and-generate.png) Whenever you update your Prisma schema, you will have to update your database schema using either `prisma migrate dev` or `prisma db push`. This will keep your database schema in sync with your Prisma schema. The commands will also regenerate Prisma Client. - - - - - Creating the database schema - - - - Querying the database - - - diff --git a/content/100-getting-started/02-setup-prisma/100-start-from-scratch/110-relational-databases/200-install-prisma-client-typescript-postgresql.mdx b/content/100-getting-started/02-setup-prisma/100-start-from-scratch/110-relational-databases/200-install-prisma-client-typescript-postgresql.mdx index b3022b9a7d..0fc9c187ba 100644 --- a/content/100-getting-started/02-setup-prisma/100-start-from-scratch/110-relational-databases/200-install-prisma-client-typescript-postgresql.mdx +++ b/content/100-getting-started/02-setup-prisma/100-start-from-scratch/110-relational-databases/200-install-prisma-client-typescript-postgresql.mdx @@ -29,25 +29,3 @@ The install command invokes `prisma generate` for you which reads your Prisma sc ![Install and generate Prisma Client](/img/getting-started/prisma-client-install-and-generate.png) Whenever you update your Prisma schema, you will have to update your database schema using either `prisma migrate dev` or `prisma db push`. This will keep your database schema in sync with your Prisma schema. The commands will also regenerate Prisma Client. - - - - - Using Prisma Migrate - - - - Querying the database - - - diff --git a/content/100-getting-started/02-setup-prisma/100-start-from-scratch/110-relational-databases/200-install-prisma-client-typescript-sqlserver.mdx b/content/100-getting-started/02-setup-prisma/100-start-from-scratch/110-relational-databases/200-install-prisma-client-typescript-sqlserver.mdx index 4330e3a897..00f38caeca 100644 --- a/content/100-getting-started/02-setup-prisma/100-start-from-scratch/110-relational-databases/200-install-prisma-client-typescript-sqlserver.mdx +++ b/content/100-getting-started/02-setup-prisma/100-start-from-scratch/110-relational-databases/200-install-prisma-client-typescript-sqlserver.mdx @@ -30,25 +30,3 @@ The install command invokes `prisma generate` for you which reads your Prisma sc ![Install and generate Prisma Client](/img/getting-started/prisma-client-install-and-generate.png) Whenever you update your Prisma schema, you will have to update your database schema using either `prisma migrate dev` or `prisma db push`. This will keep your database schema in sync with your Prisma schema. The commands will also regenerate Prisma Client. - - - - - Using Prisma Migrate - - - - Querying the database - - - diff --git a/content/100-getting-started/02-setup-prisma/100-start-from-scratch/110-relational-databases/250-querying-the-database-node-cockroachdb.mdx b/content/100-getting-started/02-setup-prisma/100-start-from-scratch/110-relational-databases/250-querying-the-database-node-cockroachdb.mdx index e4f21a86f8..02bdd431a9 100644 --- a/content/100-getting-started/02-setup-prisma/100-start-from-scratch/110-relational-databases/250-querying-the-database-node-cockroachdb.mdx +++ b/content/100-getting-started/02-setup-prisma/100-start-from-scratch/110-relational-databases/250-querying-the-database-node-cockroachdb.mdx @@ -22,7 +22,7 @@ Now that you have generated [Prisma Client](/orm/prisma-client), you can start w Create a new file named `index.js` and add the following code to it: -```js file=index.js copy +```js file=index.js copy showLineNumbers const { PrismaClient } = require('@prisma/client') const prisma = new PrismaClient() @@ -52,11 +52,14 @@ Here's a quick overview of the different parts of the code snippet: Inside the `main` function, add the following query to read all `User` records from the database and print the result: -```js file=index.js highlight=2;delete|3,4;add +```js file=index.js highlight=2;delete|3,4;add showLineNumbers async function main() { + //delete-next-line // ... you will write your Prisma Client queries here + //add-start const allUsers = await prisma.user.findMany() console.log(allUsers) + //add-end } ``` @@ -78,8 +81,9 @@ The `findMany` query you used in the previous section only _reads_ data from the Adjust the `main` function to send a `create` query to the database: -```js file=index.js highlight=2-21;add copy +```js file=index.js highlight=2-21;add copy showLineNumbers async function main() { + //add-start await prisma.user.create({ data: { name: 'Alice', @@ -100,6 +104,7 @@ async function main() { }, }) console.dir(allUsers, { depth: null }) + //add-end } ``` @@ -202,25 +207,3 @@ The `Post` record with an `id` of `1` now got updated in the database: | `1` | `"Hello World"` | `null` | `true` | `1` | Fantastic, you just wrote new data into your database for the first time using Prisma Client 🚀 - - - - - Install Prisma Client - - - - Next Steps - - - diff --git a/content/100-getting-started/02-setup-prisma/100-start-from-scratch/110-relational-databases/250-querying-the-database-node-mysql.mdx b/content/100-getting-started/02-setup-prisma/100-start-from-scratch/110-relational-databases/250-querying-the-database-node-mysql.mdx index a699ad138d..5f44d6e771 100644 --- a/content/100-getting-started/02-setup-prisma/100-start-from-scratch/110-relational-databases/250-querying-the-database-node-mysql.mdx +++ b/content/100-getting-started/02-setup-prisma/100-start-from-scratch/110-relational-databases/250-querying-the-database-node-mysql.mdx @@ -22,7 +22,7 @@ Now that you have generated [Prisma Client](/orm/prisma-client), you can start w Create a new file named `index.js` and add the following code to it: -```js file=index.js copy +```js file=index.js copy showLineNumbers const { PrismaClient } = require('@prisma/client') const prisma = new PrismaClient() @@ -56,10 +56,10 @@ Inside the `main` function, add the following query to read all `User` records f async function main() { //delete-next-line // ... you will write your Prisma Client queries here - //highlight-start + //add-start const allUsers = await prisma.user.findMany() console.log(allUsers) - //highlight-end + //add-end } ``` @@ -81,8 +81,9 @@ The `findMany` query you used in the previous section only _reads_ data from the Adjust the `main` function to send a `create` query to the database: -```js file=index.js highlight=2-21;add copy +```js file=index.js highlight=2-21;add copy showLineNumbers async function main() { + //add-start await prisma.user.create({ data: { name: 'Alice', @@ -103,6 +104,7 @@ async function main() { }, }) console.dir(allUsers, { depth: null }) + //add-end } ``` @@ -205,20 +207,3 @@ The `Post` record with an `id` of `1` now got updated in the database: | `1` | `"Hello World"` | `null` | `true` | `1` | Fantastic, you just wrote new data into your database for the first time using Prisma Client 🚀 - - - - - Install Prisma Client - - - - Next Steps - - - diff --git a/content/100-getting-started/02-setup-prisma/100-start-from-scratch/110-relational-databases/250-querying-the-database-node-planetscale.mdx b/content/100-getting-started/02-setup-prisma/100-start-from-scratch/110-relational-databases/250-querying-the-database-node-planetscale.mdx index 35229b1b0a..11b53496c6 100644 --- a/content/100-getting-started/02-setup-prisma/100-start-from-scratch/110-relational-databases/250-querying-the-database-node-planetscale.mdx +++ b/content/100-getting-started/02-setup-prisma/100-start-from-scratch/110-relational-databases/250-querying-the-database-node-planetscale.mdx @@ -22,7 +22,7 @@ Now that you have generated [Prisma Client](/orm/prisma-client), you can start w Create a new file named `index.js` and add the following code to it: -```js file=index.js copy +```js file=index.js copy showLineNumbers const { PrismaClient } = require('@prisma/client') const prisma = new PrismaClient() @@ -52,11 +52,14 @@ Here's a quick overview of the different parts of the code snippet: Inside the `main` function, add the following query to read all `User` records from the database and print the result: -```js file=index.js highlight=2;delete|3,4;add +```js file=index.js highlight=2;delete|3,4;add showLineNumbers async function main() { + //delete-next-line // ... you will write your Prisma Client queries here + //add-start const allUsers = await prisma.user.findMany() console.log(allUsers) + //add-end } ``` @@ -78,9 +81,9 @@ The `findMany` query you used in the previous section only _reads_ data from the Adjust the `main` function to send a `create` query to the database: -```js file=index.js highlight=2-21;add copy +```js file=index.js highlight=2-21;add copy showLineNumbers async function main() { - //highlight-start + //add-start await prisma.user.create({ data: { name: 'Alice', @@ -101,7 +104,7 @@ async function main() { }, }) console.dir(allUsers, { depth: null }) - //highlight-end + //add-end } ``` @@ -205,25 +208,3 @@ The `Post` record with an `id` of `1` now got updated in the database: | `1` | `"Hello World"` | `null` | `true` | `1` | Fantastic, you just wrote new data into your database for the first time using Prisma Client 🚀 - - - - - Install Prisma Client - - - - Next Steps - - - diff --git a/content/100-getting-started/02-setup-prisma/100-start-from-scratch/110-relational-databases/250-querying-the-database-node-postgresql.mdx b/content/100-getting-started/02-setup-prisma/100-start-from-scratch/110-relational-databases/250-querying-the-database-node-postgresql.mdx index 4d35eec13e..c8ba0068a7 100644 --- a/content/100-getting-started/02-setup-prisma/100-start-from-scratch/110-relational-databases/250-querying-the-database-node-postgresql.mdx +++ b/content/100-getting-started/02-setup-prisma/100-start-from-scratch/110-relational-databases/250-querying-the-database-node-postgresql.mdx @@ -22,7 +22,7 @@ Now that you have generated [Prisma Client](/orm/prisma-client), you can start w Create a new file named `index.js` and add the following code to it: -```js file=index.js copy +```js file=index.js copy showLineNumbers const { PrismaClient } = require('@prisma/client') const prisma = new PrismaClient() @@ -53,11 +53,14 @@ Here's a quick overview of the different parts of the code snippet: Inside the `main` function, add the following query to read all `User` records from the database and print the result: -```js file=index.js highlight=2;delete|3,4;add +```js file=index.js highlight=2;delete|3,4;add showLineNumbers async function main() { + //delete-next-line // ... you will write your Prisma Client queries here + //add-start const allUsers = await prisma.user.findMany() console.log(allUsers) + //add-end } ``` @@ -79,8 +82,9 @@ The `findMany` query you used in the previous section only _reads_ data from the Adjust the `main` function to send a `create` query to the database: -```js file=index.js highlight=2-21;add copy +```js file=index.js highlight=2-21;add copy showLineNumbers async function main() { + //add-start await prisma.user.create({ data: { name: 'Alice', @@ -101,6 +105,7 @@ async function main() { }, }) console.dir(allUsers, { depth: null }) + //add-end } ``` @@ -203,25 +208,3 @@ The `Post` record with an `id` of `1` now got updated in the database: | `1` | `"Hello World"` | `null` | `true` | `1` | Fantastic, you just wrote new data into your database for the first time using Prisma Client 🚀 - - - - - Install Prisma Client - - - - Next Steps - - - diff --git a/content/100-getting-started/02-setup-prisma/100-start-from-scratch/110-relational-databases/250-querying-the-database-node-sqlserver.mdx b/content/100-getting-started/02-setup-prisma/100-start-from-scratch/110-relational-databases/250-querying-the-database-node-sqlserver.mdx index 7ab1e17666..5cbb1829c9 100644 --- a/content/100-getting-started/02-setup-prisma/100-start-from-scratch/110-relational-databases/250-querying-the-database-node-sqlserver.mdx +++ b/content/100-getting-started/02-setup-prisma/100-start-from-scratch/110-relational-databases/250-querying-the-database-node-sqlserver.mdx @@ -22,7 +22,7 @@ Now that you have generated [Prisma Client](/orm/prisma-client), you can start w Create a new file named `index.js` and add the following code to it: -```js file=index.js copy +```js file=index.js copy showLineNumbers const { PrismaClient } = require('@prisma/client') const prisma = new PrismaClient() @@ -52,11 +52,14 @@ Here's a quick overview of the different parts of the code snippet: Inside the `main` function, add the following query to read all `User` records from the database and print the result: -```js file=index.js highlight=2;delete|3,4;add +```js file=index.js highlight=2;delete|3,4;add showLineNumbers async function main() { + //delete-next-line // ... you will write your Prisma Client queries here + //add-start const allUsers = await prisma.user.findMany() console.log(allUsers) + //add-end } ``` @@ -78,8 +81,9 @@ The `findMany` query you used in the previous section only _reads_ data from the Adjust the `main` function to send a `create` query to the database: -```js file=index.js highlight=2-21;add copy +```js file=index.js highlight=2-21;add copy showLineNumbers async function main() { + //add-start await prisma.user.create({ data: { name: 'Alice', @@ -100,6 +104,7 @@ async function main() { }, }) console.dir(allUsers, { depth: null }) + //add-end } ``` @@ -202,25 +207,3 @@ The `Post` record with an `id` of `1` now got updated in the database: | `1` | `"Hello World"` | `null` | `true` | `1` | Fantastic, you just wrote new data into your database for the first time using Prisma Client 🚀 - - - - - Install Prisma Client - - - - Next Steps - - - diff --git a/content/100-getting-started/02-setup-prisma/100-start-from-scratch/110-relational-databases/250-querying-the-database-typescript-cockroachdb.mdx b/content/100-getting-started/02-setup-prisma/100-start-from-scratch/110-relational-databases/250-querying-the-database-typescript-cockroachdb.mdx index bee5d29fd2..4962bda8bd 100644 --- a/content/100-getting-started/02-setup-prisma/100-start-from-scratch/110-relational-databases/250-querying-the-database-typescript-cockroachdb.mdx +++ b/content/100-getting-started/02-setup-prisma/100-start-from-scratch/110-relational-databases/250-querying-the-database-typescript-cockroachdb.mdx @@ -22,7 +22,7 @@ Now that you have generated [Prisma Client](/orm/prisma-client), you can start w Create a new file named `index.ts` and add the following code to it: -```js file=index.ts copy +```js file=index.ts copy showLineNumbers import { PrismaClient } from '@prisma/client' const prisma = new PrismaClient() @@ -52,11 +52,13 @@ Here's a quick overview of the different parts of the code snippet: Inside the `main` function, add the following query to read all `User` records from the database and print the result: -```ts file=index.ts highlight=3,4;add +```ts file=index.ts highlight=3,4;add showLineNumbers async function main() { // ... you will write your Prisma Client queries here + //add-start const allUsers = await prisma.user.findMany() console.log(allUsers) + //add-end } ``` @@ -78,8 +80,9 @@ The `findMany` query you used in the previous section only _reads_ data from the Adjust the `main` function to send a `create` query to the database: -```ts file=index.ts highlight=2-21;add copy +```ts file=index.ts highlight=2-21;add copy showLineNumbers async function main() { + //add-start await prisma.user.create({ data: { name: 'Alice', @@ -100,6 +103,7 @@ async function main() { }, }) console.dir(allUsers, { depth: null }) + //add-end } ``` @@ -181,7 +185,7 @@ The query added new records to the `User` and the `Post` tables: Before moving on to the next section, you'll "publish" the `Post` record you just created using an `update` query. Adjust the `main` function as follows: -```ts file=index.ts copy +```ts file=index.ts copy showLineNumbers async function main() { const post = await prisma.post.update({ where: { id: 1 }, @@ -218,48 +222,3 @@ The `Post` record with an `id` of `1` now got updated in the database: | `1` | `"Hello World"` | `null` | `true` | `1` | Fantastic, you just wrote new data into your database for the first time using Prisma Client 🚀 - - - - - - Install Prisma Client - - - - Next Steps - - - - - - - - Install Prisma Client - - - - Next Steps - - - diff --git a/content/100-getting-started/02-setup-prisma/100-start-from-scratch/110-relational-databases/250-querying-the-database-typescript-mysql.mdx b/content/100-getting-started/02-setup-prisma/100-start-from-scratch/110-relational-databases/250-querying-the-database-typescript-mysql.mdx index 66c53f89cb..4962bda8bd 100644 --- a/content/100-getting-started/02-setup-prisma/100-start-from-scratch/110-relational-databases/250-querying-the-database-typescript-mysql.mdx +++ b/content/100-getting-started/02-setup-prisma/100-start-from-scratch/110-relational-databases/250-querying-the-database-typescript-mysql.mdx @@ -22,7 +22,7 @@ Now that you have generated [Prisma Client](/orm/prisma-client), you can start w Create a new file named `index.ts` and add the following code to it: -```js file=index.ts copy +```js file=index.ts copy showLineNumbers import { PrismaClient } from '@prisma/client' const prisma = new PrismaClient() @@ -52,11 +52,13 @@ Here's a quick overview of the different parts of the code snippet: Inside the `main` function, add the following query to read all `User` records from the database and print the result: -```ts file=index.ts highlight=3,4;add +```ts file=index.ts highlight=3,4;add showLineNumbers async function main() { // ... you will write your Prisma Client queries here + //add-start const allUsers = await prisma.user.findMany() console.log(allUsers) + //add-end } ``` @@ -78,8 +80,9 @@ The `findMany` query you used in the previous section only _reads_ data from the Adjust the `main` function to send a `create` query to the database: -```ts file=index.ts highlight=2-21;add copy +```ts file=index.ts highlight=2-21;add copy showLineNumbers async function main() { + //add-start await prisma.user.create({ data: { name: 'Alice', @@ -100,6 +103,7 @@ async function main() { }, }) console.dir(allUsers, { depth: null }) + //add-end } ``` @@ -181,7 +185,7 @@ The query added new records to the `User` and the `Post` tables: Before moving on to the next section, you'll "publish" the `Post` record you just created using an `update` query. Adjust the `main` function as follows: -```ts file=index.ts copy +```ts file=index.ts copy showLineNumbers async function main() { const post = await prisma.post.update({ where: { id: 1 }, @@ -218,25 +222,3 @@ The `Post` record with an `id` of `1` now got updated in the database: | `1` | `"Hello World"` | `null` | `true` | `1` | Fantastic, you just wrote new data into your database for the first time using Prisma Client 🚀 - - - - - Install Prisma Client - - - - Next Steps - - - diff --git a/content/100-getting-started/02-setup-prisma/100-start-from-scratch/110-relational-databases/250-querying-the-database-typescript-planetscale.mdx b/content/100-getting-started/02-setup-prisma/100-start-from-scratch/110-relational-databases/250-querying-the-database-typescript-planetscale.mdx index f96f4360f4..91db459fb9 100644 --- a/content/100-getting-started/02-setup-prisma/100-start-from-scratch/110-relational-databases/250-querying-the-database-typescript-planetscale.mdx +++ b/content/100-getting-started/02-setup-prisma/100-start-from-scratch/110-relational-databases/250-querying-the-database-typescript-planetscale.mdx @@ -22,7 +22,7 @@ Now that you have generated [Prisma Client](/orm/prisma-client), you can start w Create a new file named `index.ts` and add the following code to it: -```js file=index.ts copy +```js file=index.ts copy showLineNumbers import { PrismaClient } from '@prisma/client' const prisma = new PrismaClient() @@ -52,11 +52,13 @@ Here's a quick overview of the different parts of the code snippet: Inside the `main` function, add the following query to read all `User` records from the database and print the result: -```ts file=index.ts highlight=3,4;add +```ts file=index.ts highlight=3,4;add showLineNumbers async function main() { // ... you will write your Prisma Client queries here + //add-start const allUsers = await prisma.user.findMany() console.log(allUsers) + //add-end } ``` @@ -78,8 +80,9 @@ The `findMany` query you used in the previous section only _reads_ data from the Adjust the `main` function to send a `create` query to the database: -```ts file=index.ts highlight=2-21;add copy +```ts file=index.ts highlight=2-21;add copy showLineNumbers async function main() { + //add-start await prisma.user.create({ data: { name: 'Alice', @@ -100,6 +103,7 @@ async function main() { }, }) console.dir(allUsers, { depth: null }) + //add-end } ``` @@ -181,7 +185,7 @@ The query added new records to the `User` and the `Post` tables: Before moving on to the next section, you'll "publish" the `Post` record you just created using an `update` query. Adjust the `main` function as follows: -```ts file=index.ts copy +```ts file=index.ts copy showLineNumbers async function main() { const post = await prisma.post.update({ where: { id: 1 }, @@ -219,47 +223,3 @@ The `Post` record with an `id` of `1` now got updated in the database: Fantastic, you just wrote new data into your database for the first time using Prisma Client 🚀 - - - - - Install Prisma Client - - - - Next Steps - - - - - - - - Install Prisma Client - - - - Next Steps - - - diff --git a/content/100-getting-started/02-setup-prisma/100-start-from-scratch/110-relational-databases/250-querying-the-database-typescript-postgresql.mdx b/content/100-getting-started/02-setup-prisma/100-start-from-scratch/110-relational-databases/250-querying-the-database-typescript-postgresql.mdx index 4c9323f97e..611acc2b9f 100644 --- a/content/100-getting-started/02-setup-prisma/100-start-from-scratch/110-relational-databases/250-querying-the-database-typescript-postgresql.mdx +++ b/content/100-getting-started/02-setup-prisma/100-start-from-scratch/110-relational-databases/250-querying-the-database-typescript-postgresql.mdx @@ -21,7 +21,7 @@ Now that you have generated [Prisma Client](/orm/prisma-client), you can start w Create a new file named `index.ts` and add the following code to it: -```js file=index.ts copy +```js file=index.ts copy showLineNumbers import { PrismaClient } from '@prisma/client' const prisma = new PrismaClient() @@ -51,11 +51,13 @@ Here's a quick overview of the different parts of the code snippet: Inside the `main` function, add the following query to read all `User` records from the database and print the result: -```ts file=index.ts highlight=3,4;add +```ts file=index.ts highlight=3,4;add showLineNumbers async function main() { // ... you will write your Prisma Client queries here + //add-start const allUsers = await prisma.user.findMany() console.log(allUsers) + //add-end } ``` @@ -77,8 +79,9 @@ The `findMany` query you used in the previous section only _reads_ data from the Adjust the `main` function to send a `create` query to the database: -```ts file=index.ts highlight=2-21;add copy +```ts file=index.ts highlight=2-21;add copy showLineNumbers async function main() { + //add-start await prisma.user.create({ data: { name: 'Alice', @@ -99,6 +102,7 @@ async function main() { }, }) console.dir(allUsers, { depth: null }) + //add-end } ``` @@ -180,7 +184,7 @@ The query added new records to the `User` and the `Post` tables: Before moving on to the next section, you'll "publish" the `Post` record you just created using an `update` query. Adjust the `main` function as follows: -```ts file=index.ts copy +```ts file=index.ts copy showLineNumbers async function main() { const post = await prisma.post.update({ where: { id: 1 }, @@ -217,25 +221,3 @@ The `Post` record with an `id` of `1` now got updated in the database: | `1` | `"Hello World"` | `null` | `true` | `1` | Fantastic, you just wrote new data into your database for the first time using Prisma Client 🚀 - - - - - Install Prisma Client - - - - Next Steps - - - diff --git a/content/100-getting-started/02-setup-prisma/100-start-from-scratch/110-relational-databases/250-querying-the-database-typescript-sqlserver.mdx b/content/100-getting-started/02-setup-prisma/100-start-from-scratch/110-relational-databases/250-querying-the-database-typescript-sqlserver.mdx index 71b516a0c0..d555d63552 100644 --- a/content/100-getting-started/02-setup-prisma/100-start-from-scratch/110-relational-databases/250-querying-the-database-typescript-sqlserver.mdx +++ b/content/100-getting-started/02-setup-prisma/100-start-from-scratch/110-relational-databases/250-querying-the-database-typescript-sqlserver.mdx @@ -22,7 +22,7 @@ Now that you have generated [Prisma Client](/orm/prisma-client), you can start w Create a new file named `index.ts` and add the following code to it: -```js file=index.ts copy +```js file=index.ts copy showLineNumbers import { PrismaClient } from '@prisma/client' const prisma = new PrismaClient() @@ -52,11 +52,13 @@ Here's a quick overview of the different parts of the code snippet: Inside the `main` function, add the following query to read all `User` records from the database and print the result: -```ts file=index.ts highlight=3,4;add +```ts file=index.ts highlight=3,4;add showLineNumbers async function main() { // ... you will write your Prisma Client queries here + //add-start const allUsers = await prisma.user.findMany() console.log(allUsers) + //add-end } ``` @@ -78,8 +80,9 @@ The `findMany` query you used in the previous section only _reads_ data from the Adjust the `main` function to send a `create` query to the database: -```ts file=index.ts highlight=2-21;add copy +```ts file=index.ts highlight=2-21;add copy showLineNumbers async function main() { + //add-start await prisma.user.create({ data: { name: 'Alice', @@ -100,6 +103,7 @@ async function main() { }, }) console.dir(allUsers, { depth: null }) + //add-end } ``` @@ -181,7 +185,7 @@ The query added new records to the `User` and the `Post` tables: Before moving on to the next section, you'll "publish" the `Post` record you just created using an `update` query. Adjust the `main` function as follows: -```ts file=index.ts copy +```ts file=index.ts copy showLineNumbers async function main() { const post = await prisma.post.update({ where: { id: 1 }, @@ -220,46 +224,3 @@ The `Post` record with an `id` of `1` now got updated in the database: Fantastic, you just wrote new data into your database for the first time using Prisma Client 🚀 - - - - Install Prisma Client - - - - Next Steps - - - - - - - - Install Prisma Client - - - - Next Steps - - - \ No newline at end of file diff --git a/content/100-getting-started/02-setup-prisma/100-start-from-scratch/120-mongodb-node-mongodb.mdx b/content/100-getting-started/02-setup-prisma/100-start-from-scratch/120-mongodb-node-mongodb.mdx index 6d8c291307..c449204456 100644 --- a/content/100-getting-started/02-setup-prisma/100-start-from-scratch/120-mongodb-node-mongodb.mdx +++ b/content/100-getting-started/02-setup-prisma/100-start-from-scratch/120-mongodb-node-mongodb.mdx @@ -72,16 +72,3 @@ This command does two things: - creates a new directory called `prisma` that contains a file called `schema.prisma`, which contains the Prisma schema with your database connection variable and schema models - creates the [`.env` file](/orm/more/development-environment/environment-variables/env-files) in the root directory of the project, which is used for defining environment variables (such as your database connection) - - - - - Connect your database - - - diff --git a/content/100-getting-started/02-setup-prisma/100-start-from-scratch/120-mongodb-typescript-mongodb.mdx b/content/100-getting-started/02-setup-prisma/100-start-from-scratch/120-mongodb-typescript-mongodb.mdx index 24d7077696..c5d24af3d7 100644 --- a/content/100-getting-started/02-setup-prisma/100-start-from-scratch/120-mongodb-typescript-mongodb.mdx +++ b/content/100-getting-started/02-setup-prisma/100-start-from-scratch/120-mongodb-typescript-mongodb.mdx @@ -77,16 +77,3 @@ This command does two things: - creates a new directory called `prisma` that contains a file called `schema.prisma`, which contains the Prisma schema with your database connection variable and schema models - creates the [`.env` file](/orm/more/development-environment/environment-variables/env-files) in the root directory of the project, which is used for defining environment variables (such as your database connection) - - - - - Connect your database - - - diff --git a/content/100-getting-started/02-setup-prisma/100-start-from-scratch/120-mongodb/100-connect-your-database-node-mongodb.mdx b/content/100-getting-started/02-setup-prisma/100-start-from-scratch/120-mongodb/100-connect-your-database-node-mongodb.mdx index 9c2268a7b8..98f4df0438 100644 --- a/content/100-getting-started/02-setup-prisma/100-start-from-scratch/120-mongodb/100-connect-your-database-node-mongodb.mdx +++ b/content/100-getting-started/02-setup-prisma/100-start-from-scratch/120-mongodb/100-connect-your-database-node-mongodb.mdx @@ -21,7 +21,7 @@ pagination_next: getting-started/setup-prisma/start-from-scratch/mongodb/creatin To connect your database, you need to set the `url` field of the `datasource` block in your Prisma schema to your database [connection URL](/orm/reference/connection-urls): -```prisma file=prisma/schema.prisma +```prisma file=prisma/schema.prisma showLineNumbers datasource db { provider = "mongodb" url = env("DATABASE_URL") @@ -49,25 +49,3 @@ Here's a short explanation of each component: - `HOST`: The host where a [`mongod`](https://docs.mongodb.com/manual/reference/program/mongod/#mongodb-binary-bin.mongod) (or [`mongos`](https://docs.mongodb.com/manual/reference/program/mongos/#mongodb-binary-bin.mongos)) instance is running - `PORT`: The port where your database server is running (typically `27017` for MongoDB) - `DATABASE`: The name of the database - - - - - Installation - - - - Creating the Prisma schema - - - diff --git a/content/100-getting-started/02-setup-prisma/100-start-from-scratch/120-mongodb/100-connect-your-database-typescript-mongodb.mdx b/content/100-getting-started/02-setup-prisma/100-start-from-scratch/120-mongodb/100-connect-your-database-typescript-mongodb.mdx index b9af15f1ac..53233ae2b9 100644 --- a/content/100-getting-started/02-setup-prisma/100-start-from-scratch/120-mongodb/100-connect-your-database-typescript-mongodb.mdx +++ b/content/100-getting-started/02-setup-prisma/100-start-from-scratch/120-mongodb/100-connect-your-database-typescript-mongodb.mdx @@ -19,7 +19,7 @@ pagination_next: getting-started/setup-prisma/start-from-scratch/mongodb/creatin To connect your database, you need to set the `url` field of the `datasource` block in your Prisma schema to your database [connection URL](/orm/reference/connection-urls): -```prisma file=prisma/schema.prisma +```prisma file=prisma/schema.prisma showLineNumbers datasource db { provider = "mongodb" url = env("DATABASE_URL") @@ -47,25 +47,3 @@ Here's a short explanation of each component: - `HOST`: The host where a [`mongod`](https://docs.mongodb.com/manual/reference/program/mongod/#mongodb-binary-bin.mongod) (or [`mongos`](https://docs.mongodb.com/manual/reference/program/mongos/#mongodb-binary-bin.mongos)) instance is running - `PORT`: The port where your database server is running (typically `27017` for MongoDB) - `DATABASE`: The name of the database - - - - - Installation - - - - Creating the Prisma schema - - - diff --git a/content/100-getting-started/02-setup-prisma/100-start-from-scratch/120-mongodb/125-creating-the-prisma-schema-node-mongodb.mdx b/content/100-getting-started/02-setup-prisma/100-start-from-scratch/120-mongodb/125-creating-the-prisma-schema-node-mongodb.mdx index 43b36a19fd..3b4b9b0c6d 100644 --- a/content/100-getting-started/02-setup-prisma/100-start-from-scratch/120-mongodb/125-creating-the-prisma-schema-node-mongodb.mdx +++ b/content/100-getting-started/02-setup-prisma/100-start-from-scratch/120-mongodb/125-creating-the-prisma-schema-node-mongodb.mdx @@ -21,7 +21,7 @@ pagination_next: getting-started/setup-prisma/start-from-scratch/mongodb/install Open the `prisma/schema.prisma` file and replace the default contents with the following: -```prisma file=prisma/schema.prisma +```prisma file=prisma/schema.prisma showLineNumbers datasource db { provider = "mongodb" url = env("DATABASE_URL") @@ -70,25 +70,3 @@ There are also a number of subtle differences in how the schema is setup when co For example, the underlying `ID` field name is always `_id` and must be mapped with `@map("_id")`. For more information check out the [MongoDB schema reference](/orm/reference/prisma-schema-reference#mongodb-2). - - - - - Connect your database - - - - Install Prisma Client - - - diff --git a/content/100-getting-started/02-setup-prisma/100-start-from-scratch/120-mongodb/125-creating-the-prisma-schema-typescript-mongodb.mdx b/content/100-getting-started/02-setup-prisma/100-start-from-scratch/120-mongodb/125-creating-the-prisma-schema-typescript-mongodb.mdx index c05a7759f9..4a8e7fa41d 100644 --- a/content/100-getting-started/02-setup-prisma/100-start-from-scratch/120-mongodb/125-creating-the-prisma-schema-typescript-mongodb.mdx +++ b/content/100-getting-started/02-setup-prisma/100-start-from-scratch/120-mongodb/125-creating-the-prisma-schema-typescript-mongodb.mdx @@ -19,7 +19,7 @@ pagination_next: getting-started/setup-prisma/start-from-scratch/mongodb/install Open the `prisma/schema.prisma` file and replace the default contents with the following: -```prisma file=prisma/schema.prisma +```prisma file=prisma/schema.prisma showLineNumbers datasource db { provider = "mongodb" url = env("DATABASE_URL") @@ -69,24 +69,3 @@ For example, the underlying `ID` field name is always `_id` and must be mapped w For more information check out the [MongoDB schema reference](/orm/reference/prisma-schema-reference#mongodb-2). - - - - Connect your database - - - - Install Prisma Client - - - diff --git a/content/100-getting-started/02-setup-prisma/100-start-from-scratch/120-mongodb/200-install-prisma-client-node-mongodb.mdx b/content/100-getting-started/02-setup-prisma/100-start-from-scratch/120-mongodb/200-install-prisma-client-node-mongodb.mdx index 06a77e1f6c..64712a04ee 100644 --- a/content/100-getting-started/02-setup-prisma/100-start-from-scratch/120-mongodb/200-install-prisma-client-node-mongodb.mdx +++ b/content/100-getting-started/02-setup-prisma/100-start-from-scratch/120-mongodb/200-install-prisma-client-node-mongodb.mdx @@ -29,25 +29,3 @@ The install command invokes `prisma generate` for you which reads your Prisma sc ![Install and generate Prisma Client](/img/getting-started/prisma-client-install-and-generate.png) Whenever you update your Prisma schema, you will need to run the `prisma db push` command to create new indexes and regenerate Prisma Client. - - - - - Creating the Prisma schema - - - - Querying the database - - - diff --git a/content/100-getting-started/02-setup-prisma/100-start-from-scratch/120-mongodb/200-install-prisma-client-typescript-mongodb.mdx b/content/100-getting-started/02-setup-prisma/100-start-from-scratch/120-mongodb/200-install-prisma-client-typescript-mongodb.mdx index 666b47630b..d755165a72 100644 --- a/content/100-getting-started/02-setup-prisma/100-start-from-scratch/120-mongodb/200-install-prisma-client-typescript-mongodb.mdx +++ b/content/100-getting-started/02-setup-prisma/100-start-from-scratch/120-mongodb/200-install-prisma-client-typescript-mongodb.mdx @@ -28,25 +28,3 @@ The install command invokes `prisma generate` for you which reads your Prisma sc ![Install and generate Prisma Client](/img/getting-started/prisma-client-install-and-generate.png) Whenever you update your Prisma schema, you will need to run the `prisma db push` command to create new indexes and regenerate Prisma Client. - - - - - Creating the Prisma schema - - - - Querying the database - - - diff --git a/content/100-getting-started/02-setup-prisma/100-start-from-scratch/120-mongodb/250-querying-the-database-node-mongodb.mdx b/content/100-getting-started/02-setup-prisma/100-start-from-scratch/120-mongodb/250-querying-the-database-node-mongodb.mdx index 3e3acf1775..d4d16b4df3 100644 --- a/content/100-getting-started/02-setup-prisma/100-start-from-scratch/120-mongodb/250-querying-the-database-node-mongodb.mdx +++ b/content/100-getting-started/02-setup-prisma/100-start-from-scratch/120-mongodb/250-querying-the-database-node-mongodb.mdx @@ -22,7 +22,7 @@ Now that you have generated Prisma Client, you can start writing queries to read Create a new file named `index.js` and add the following code to it: -```js file=index.js copy +```js file=index.js copy showLineNumbers const { PrismaClient } = require('@prisma/client') const prisma = new PrismaClient() @@ -55,9 +55,12 @@ Inside the `main` function, add the following query to read all `User` records f ```js file=index.js async function main() { + //delete-next-line - // ... you will write your Prisma Client queries here +//add-start + const allUsers = await prisma.user.findMany() + console.log(allUsers) +//add-end } ``` @@ -79,8 +82,9 @@ The `findMany` query you used in the previous section only _reads_ data from the Adjust the `main` function to send a `create` query to the database: -```js file=index.js highlight=2-21;add copy +```js file=index.js highlight=2-21;add copy showLineNumbers async function main() { + //add-start await prisma.user.create({ data: { name: 'Rich', @@ -101,6 +105,7 @@ async function main() { }, }) console.dir(allUsers, { depth: null }) + //add-end } ``` @@ -154,7 +159,7 @@ The query added new records to the `User` and the `Post` tables: Before moving on to the next section, you'll add a couple of comments to the `Post` record you just created using an `update` query. Adjust the `main` function as follows: -```js file=index.js copy +```js file=index.js copy showLineNumbers async function main() { await prisma.post.update({ where: { @@ -214,20 +219,3 @@ You will see the following output: ``` Fantastic, you just wrote new data into your database for the first time using Prisma Client 🚀 - - - - - Install Prisma Client - - - - Next Steps - - - diff --git a/content/100-getting-started/02-setup-prisma/100-start-from-scratch/120-mongodb/250-querying-the-database-typescript-mongodb.mdx b/content/100-getting-started/02-setup-prisma/100-start-from-scratch/120-mongodb/250-querying-the-database-typescript-mongodb.mdx index d0e73e19cb..5ccb308ffc 100644 --- a/content/100-getting-started/02-setup-prisma/100-start-from-scratch/120-mongodb/250-querying-the-database-typescript-mongodb.mdx +++ b/content/100-getting-started/02-setup-prisma/100-start-from-scratch/120-mongodb/250-querying-the-database-typescript-mongodb.mdx @@ -21,7 +21,7 @@ Now that you have generated Prisma Client, you can start writing queries to read Create a new file named `index.ts` and add the following code to it: -```js file=index.ts copy +```js file=index.ts copy showLineNumbers import { PrismaClient } from '@prisma/client' const prisma = new PrismaClient() @@ -51,15 +51,16 @@ Here's a quick overview of the different parts of the code snippet: Inside the `main` function, add the following query to read all `User` records from the database and print the result: -```ts file=index.ts +```ts file=index.ts showLineNumbers async function main() { // ... you will write your Prisma Client queries here +//add-start + const allUsers = await prisma.user.findMany() + console.log(allUsers) +//add-end } ``` - Now run the code with this command: ```terminal copy @@ -78,8 +79,9 @@ The `findMany` query you used in the previous section only _reads_ data from the Adjust the `main` function to send a `create` query to the database: -```ts file=index.ts highlight=2-21;add copy +```ts file=index.ts highlight=2-21;add copy showLineNumbers async function main() { + //add-start await prisma.user.create({ data: { name: 'Rich', @@ -100,6 +102,7 @@ async function main() { }, }) console.dir(allUsers, { depth: null }) + //add-end } ``` @@ -169,7 +172,7 @@ The query added new records to the `User` and the `Post` tables: Before moving on to the next section, you'll add a couple of comments to the `Post` record you just created using an `update` query. Adjust the `main` function as follows: -```ts file=index.ts copy +```ts file=index.ts copy showLineNumbers async function main() { await prisma.post.update({ where: { @@ -229,25 +232,3 @@ You will see the following output: ``` Fantastic, you just wrote new data into your database for the first time using Prisma Client 🚀 - - - - - Install Prisma Client - - - - Next Steps - - - diff --git a/content/100-getting-started/02-setup-prisma/200-add-to-existing-project/110-relational-databases-node-cockroachdb.mdx b/content/100-getting-started/02-setup-prisma/200-add-to-existing-project/110-relational-databases-node-cockroachdb.mdx index 233c76c3f6..3e4b389631 100644 --- a/content/100-getting-started/02-setup-prisma/200-add-to-existing-project/110-relational-databases-node-cockroachdb.mdx +++ b/content/100-getting-started/02-setup-prisma/200-add-to-existing-project/110-relational-databases-node-cockroachdb.mdx @@ -75,16 +75,3 @@ This command does two things: - creates a new directory called `prisma` that contains a file called `schema.prisma`, which contains the Prisma schema with your database connection variable and schema models - creates the [`.env` file](/orm/more/development-environment/environment-variables/env-files) in the root directory of the project, which is used for defining environment variables (such as your database connection) - - - - - Connect your database - - - diff --git a/content/100-getting-started/02-setup-prisma/200-add-to-existing-project/110-relational-databases-node-mysql.mdx b/content/100-getting-started/02-setup-prisma/200-add-to-existing-project/110-relational-databases-node-mysql.mdx index 60c4aa99b4..d6f89f9585 100644 --- a/content/100-getting-started/02-setup-prisma/200-add-to-existing-project/110-relational-databases-node-mysql.mdx +++ b/content/100-getting-started/02-setup-prisma/200-add-to-existing-project/110-relational-databases-node-mysql.mdx @@ -76,16 +76,3 @@ This command does two things: - creates a new directory called `prisma` that contains a file called `schema.prisma`, which contains the Prisma schema with your database connection variable and schema models - creates the [`.env` file](/orm/more/development-environment/environment-variables/env-files) in the root directory of the project, which is used for defining environment variables (such as your database connection) - - - - - Connect your database - - - diff --git a/content/100-getting-started/02-setup-prisma/200-add-to-existing-project/110-relational-databases-node-planetscale.mdx b/content/100-getting-started/02-setup-prisma/200-add-to-existing-project/110-relational-databases-node-planetscale.mdx index 03e2436057..fdf2981664 100644 --- a/content/100-getting-started/02-setup-prisma/200-add-to-existing-project/110-relational-databases-node-planetscale.mdx +++ b/content/100-getting-started/02-setup-prisma/200-add-to-existing-project/110-relational-databases-node-planetscale.mdx @@ -74,16 +74,3 @@ This command does two things: - creates a new directory called `prisma` that contains a file called `schema.prisma`, which contains the Prisma schema with your database connection variable and schema models - creates the [`.env` file](/orm/more/development-environment/environment-variables/env-files) in the root directory of the project, which is used for defining environment variables (such as your database connection) - - - - - Connect your database - - - diff --git a/content/100-getting-started/02-setup-prisma/200-add-to-existing-project/110-relational-databases-node-postgresql.mdx b/content/100-getting-started/02-setup-prisma/200-add-to-existing-project/110-relational-databases-node-postgresql.mdx index f8c4cc888f..df24231dac 100644 --- a/content/100-getting-started/02-setup-prisma/200-add-to-existing-project/110-relational-databases-node-postgresql.mdx +++ b/content/100-getting-started/02-setup-prisma/200-add-to-existing-project/110-relational-databases-node-postgresql.mdx @@ -76,15 +76,3 @@ This command does two things: - creates a new directory called `prisma` that contains a file called `schema.prisma`, which contains the Prisma schema with your database connection variable and schema models - creates the [`.env` file](/orm/more/development-environment/environment-variables/env-files) in the root directory of the project, which is used for defining environment variables (such as your database connection) - - - - Connect your database - - - diff --git a/content/100-getting-started/02-setup-prisma/200-add-to-existing-project/110-relational-databases-node-sqlserver.mdx b/content/100-getting-started/02-setup-prisma/200-add-to-existing-project/110-relational-databases-node-sqlserver.mdx index 42895ca978..49936ac223 100644 --- a/content/100-getting-started/02-setup-prisma/200-add-to-existing-project/110-relational-databases-node-sqlserver.mdx +++ b/content/100-getting-started/02-setup-prisma/200-add-to-existing-project/110-relational-databases-node-sqlserver.mdx @@ -69,16 +69,3 @@ This command does two things: - creates a new directory called `prisma` that contains a file called `schema.prisma`, which contains the Prisma schema with your database connection variable and schema models - creates the [`.env` file](/orm/more/development-environment/environment-variables/env-files) in the root directory of the project, which is used for defining environment variables (such as your database connection) - - - - - Connect your database - - - diff --git a/content/100-getting-started/02-setup-prisma/200-add-to-existing-project/110-relational-databases-typescript-cockroachdb.mdx b/content/100-getting-started/02-setup-prisma/200-add-to-existing-project/110-relational-databases-typescript-cockroachdb.mdx index 4282c7b1f8..e04c347c20 100644 --- a/content/100-getting-started/02-setup-prisma/200-add-to-existing-project/110-relational-databases-typescript-cockroachdb.mdx +++ b/content/100-getting-started/02-setup-prisma/200-add-to-existing-project/110-relational-databases-typescript-cockroachdb.mdx @@ -75,17 +75,3 @@ This command does two things: - creates a new directory called `prisma` that contains a file called `schema.prisma`, which contains the Prisma schema with your database connection variable and schema models - creates the [`.env` file](/orm/more/development-environment/environment-variables/env-files) in the root directory of the project, which is used for defining environment variables (such as your database connection) - - - - - Connect your database - - - - diff --git a/content/100-getting-started/02-setup-prisma/200-add-to-existing-project/110-relational-databases-typescript-mysql.mdx b/content/100-getting-started/02-setup-prisma/200-add-to-existing-project/110-relational-databases-typescript-mysql.mdx index b69ff27df1..1372a0ae99 100644 --- a/content/100-getting-started/02-setup-prisma/200-add-to-existing-project/110-relational-databases-typescript-mysql.mdx +++ b/content/100-getting-started/02-setup-prisma/200-add-to-existing-project/110-relational-databases-typescript-mysql.mdx @@ -74,16 +74,3 @@ This command does two things: - creates a new directory called `prisma` that contains a file called `schema.prisma`, which contains the Prisma schema with your database connection variable and schema models - creates the [`.env` file](/orm/more/development-environment/environment-variables/env-files) in the root directory of the project, which is used for defining environment variables (such as your database connection) - - - - - Connect your database - - - diff --git a/content/100-getting-started/02-setup-prisma/200-add-to-existing-project/110-relational-databases-typescript-planetscale.mdx b/content/100-getting-started/02-setup-prisma/200-add-to-existing-project/110-relational-databases-typescript-planetscale.mdx index 1a27f0b2c8..bc4df8e87d 100644 --- a/content/100-getting-started/02-setup-prisma/200-add-to-existing-project/110-relational-databases-typescript-planetscale.mdx +++ b/content/100-getting-started/02-setup-prisma/200-add-to-existing-project/110-relational-databases-typescript-planetscale.mdx @@ -74,16 +74,3 @@ This command does two things: - creates a new directory called `prisma` that contains a file called `schema.prisma`, which contains the Prisma schema with your database connection variable and schema models - creates the [`.env` file](/orm/more/development-environment/environment-variables/env-files) in the root directory of the project, which is used for defining environment variables (such as your database connection) - - - - - Connect your database - - - diff --git a/content/100-getting-started/02-setup-prisma/200-add-to-existing-project/110-relational-databases-typescript-postgresql.mdx b/content/100-getting-started/02-setup-prisma/200-add-to-existing-project/110-relational-databases-typescript-postgresql.mdx index 31d0d05fe0..8262062e74 100644 --- a/content/100-getting-started/02-setup-prisma/200-add-to-existing-project/110-relational-databases-typescript-postgresql.mdx +++ b/content/100-getting-started/02-setup-prisma/200-add-to-existing-project/110-relational-databases-typescript-postgresql.mdx @@ -71,16 +71,3 @@ This command does two things: - creates a new directory called `prisma` that contains a file called `schema.prisma`, which contains the Prisma schema with your database connection variable and schema models - creates the [`.env` file](/orm/more/development-environment/environment-variables/env-files) in the root directory of the project, which is used for defining environment variables (such as your database connection) - - - - - Connect your database - - - diff --git a/content/100-getting-started/02-setup-prisma/200-add-to-existing-project/110-relational-databases-typescript-sqlserver.mdx b/content/100-getting-started/02-setup-prisma/200-add-to-existing-project/110-relational-databases-typescript-sqlserver.mdx index dc2a3e7d5f..7e26b4c46c 100644 --- a/content/100-getting-started/02-setup-prisma/200-add-to-existing-project/110-relational-databases-typescript-sqlserver.mdx +++ b/content/100-getting-started/02-setup-prisma/200-add-to-existing-project/110-relational-databases-typescript-sqlserver.mdx @@ -75,16 +75,3 @@ This command does two things: - creates a new directory called `prisma` that contains a file called `schema.prisma`, which contains the Prisma schema with your database connection variable and schema models - creates the [`.env` file](/orm/more/development-environment/environment-variables/env-files) in the root directory of the project, which is used for defining environment variables (such as your database connection) - - - - - Connect your database - - - diff --git a/content/100-getting-started/02-setup-prisma/200-add-to-existing-project/110-relational-databases/100-connect-your-database-node-cockroachdb.mdx b/content/100-getting-started/02-setup-prisma/200-add-to-existing-project/110-relational-databases/100-connect-your-database-node-cockroachdb.mdx index f2ed2a2b73..2c3c6dadd8 100644 --- a/content/100-getting-started/02-setup-prisma/200-add-to-existing-project/110-relational-databases/100-connect-your-database-node-cockroachdb.mdx +++ b/content/100-getting-started/02-setup-prisma/200-add-to-existing-project/110-relational-databases/100-connect-your-database-node-cockroachdb.mdx @@ -22,7 +22,7 @@ pagination_next: getting-started/setup-prisma/add-to-existing-project/relational To connect your database, you need to set the `url` field of the `datasource` block in your Prisma schema to your database [connection URL](/orm/reference/connection-urls): -```prisma file=prisma/schema.prisma +```prisma file=prisma/schema.prisma showLineNumbers datasource db { provider = "postgresql" url = env("DATABASE_URL") @@ -31,8 +31,9 @@ datasource db { Note that the default schema created by `prisma init` uses PostgreSQL as the `provider`. For CockroachDB, you need to edit the `datasource` block to use the `cockroachdb` provider instead: -```prisma file=prisma/schema.prisma highlight=2;edit +```prisma file=prisma/schema.prisma highlight=2;edit showLineNumbers datasource db { + //edit-next-line provider = "cockroachdb" url = env("DATABASE_URL") } @@ -72,24 +73,3 @@ DATABASE_URL="postgresql://root@localhost:26257?sslmode=disable" Your connection string is displayed as part of the welcome text when starting CockroachDB from the command line. - - - - Installation - - - - Introspection - - - diff --git a/content/100-getting-started/02-setup-prisma/200-add-to-existing-project/110-relational-databases/100-connect-your-database-node-mysql.mdx b/content/100-getting-started/02-setup-prisma/200-add-to-existing-project/110-relational-databases/100-connect-your-database-node-mysql.mdx index 380a7aa73c..759249a0a6 100644 --- a/content/100-getting-started/02-setup-prisma/200-add-to-existing-project/110-relational-databases/100-connect-your-database-node-mysql.mdx +++ b/content/100-getting-started/02-setup-prisma/200-add-to-existing-project/110-relational-databases/100-connect-your-database-node-mysql.mdx @@ -21,7 +21,7 @@ pagination_next: getting-started/setup-prisma/add-to-existing-project/relational To connect your database, you need to set the `url` field of the `datasource` block in your Prisma schema to your database [connection URL](/orm/reference/connection-urls): -```prisma file=prisma/schema.prisma +```prisma file=prisma/schema.prisma showLineNumbers datasource db { provider = "postgresql" url = env("DATABASE_URL") @@ -30,8 +30,9 @@ datasource db { Note that the default schema created by `prisma init` uses PostgreSQL, so you first need to switch the `provider` to `mysql`: -```prisma file=prisma/schema.prisma highlight=2;edit +```prisma file=prisma/schema.prisma highlight=2;edit showLineNumbers datasource db { + //edit-next-line provider = "mysql" url = env("DATABASE_URL") } @@ -72,19 +73,3 @@ When running MySQL locally, your connection URL typically looks similar to this: DATABASE_URL="mysql://root:randompassword@localhost:3306/mydb" ``` - - - - Installation - - - - Introspection - - - diff --git a/content/100-getting-started/02-setup-prisma/200-add-to-existing-project/110-relational-databases/100-connect-your-database-node-planetscale.mdx b/content/100-getting-started/02-setup-prisma/200-add-to-existing-project/110-relational-databases/100-connect-your-database-node-planetscale.mdx index bf31328bd8..9597067c06 100644 --- a/content/100-getting-started/02-setup-prisma/200-add-to-existing-project/110-relational-databases/100-connect-your-database-node-planetscale.mdx +++ b/content/100-getting-started/02-setup-prisma/200-add-to-existing-project/110-relational-databases/100-connect-your-database-node-planetscale.mdx @@ -21,7 +21,7 @@ pagination_next: getting-started/setup-prisma/add-to-existing-project/relational To connect your database, you need to set the `url` field of the `datasource` block in your Prisma schema to your database [connection URL](/orm/reference/connection-urls): -```prisma file=prisma/schema.prisma +```prisma file=prisma/schema.prisma showLineNumbers datasource db { provider = "postgresql" url = env("DATABASE_URL") @@ -30,8 +30,9 @@ datasource db { Note that the default schema created by `prisma init` uses PostgreSQL as the `provider`. For PlanetScale, you need to edit the `datasource` block to use the `mysql` provider instead: -```prisma file=prisma/schema.prisma highlight=2;edit +```prisma file=prisma/schema.prisma highlight=2;edit showLineNumbers datasource db { + //edit-next-line provider = "mysql" url = env("DATABASE_URL") } @@ -39,10 +40,11 @@ datasource db { You will also need to [set the relation mode type to `prisma`](/orm/prisma-schema/data-model/relations/relation-mode#emulate-relations-in-prisma-orm-with-the-prisma-relation-mode) in the `datasource` block: -```prisma file=schema.prisma highlight=4;add +```prisma file=schema.prisma highlight=4;add showLineNumbers datasource db { provider = "mysql" url = env("DATABASE_URL") + //add-next-line relationMode = "prisma" } ``` @@ -97,24 +99,3 @@ The `--port` flag can be omitted if you are using the default port `3306`. - - - - Installation - - - - Introspection - - - diff --git a/content/100-getting-started/02-setup-prisma/200-add-to-existing-project/110-relational-databases/100-connect-your-database-node-postgresql.mdx b/content/100-getting-started/02-setup-prisma/200-add-to-existing-project/110-relational-databases/100-connect-your-database-node-postgresql.mdx index ebeaf9a662..54eef0eda3 100644 --- a/content/100-getting-started/02-setup-prisma/200-add-to-existing-project/110-relational-databases/100-connect-your-database-node-postgresql.mdx +++ b/content/100-getting-started/02-setup-prisma/200-add-to-existing-project/110-relational-databases/100-connect-your-database-node-postgresql.mdx @@ -21,7 +21,7 @@ pagination_next: getting-started/setup-prisma/add-to-existing-project/relational To connect your database, you need to set the `url` field of the `datasource` block in your Prisma schema to your database [connection URL](/orm/reference/connection-urls): -```prisma file=prisma/schema.prisma +```prisma file=prisma/schema.prisma showLineNumbers datasource db { provider = "postgresql" url = env("DATABASE_URL") @@ -59,25 +59,3 @@ When running PostgreSQL locally on macOS, your user and password as well as the ```bash file=.env DATABASE_URL="postgresql://janedoe:janedoe@localhost:5432/janedoe?schema=hello-prisma" ``` - - - - - Installation - - - - Introspection - - - diff --git a/content/100-getting-started/02-setup-prisma/200-add-to-existing-project/110-relational-databases/100-connect-your-database-node-sqlserver.mdx b/content/100-getting-started/02-setup-prisma/200-add-to-existing-project/110-relational-databases/100-connect-your-database-node-sqlserver.mdx index c485325a56..4e4b7ada2b 100644 --- a/content/100-getting-started/02-setup-prisma/200-add-to-existing-project/110-relational-databases/100-connect-your-database-node-sqlserver.mdx +++ b/content/100-getting-started/02-setup-prisma/200-add-to-existing-project/110-relational-databases/100-connect-your-database-node-sqlserver.mdx @@ -21,7 +21,7 @@ pagination_next: getting-started/setup-prisma/add-to-existing-project/relational To connect your database, you need to set the `url` field of the `datasource` block in your Prisma schema to your database [connection URL](/orm/reference/connection-urls): -```prisma file=prisma/schema.prisma +```prisma file=prisma/schema.prisma showLineNumbers datasource db { provider = "sqlserver" url = env("DATABASE_URL") @@ -38,24 +38,3 @@ Adjust the connection URL to match your setup - see [Microsoft SQL Server connec > Make sure TCP/IP connections are enabled via [SQL Server Configuration Manager](https://docs.microsoft.com/en-us/sql/relational-databases/sql-server-configuration-manager) to avoid `No connection could be made because the target machine actively refused it. (os error 10061)` - - - - Installation - - - - Introspection - - - \ No newline at end of file diff --git a/content/100-getting-started/02-setup-prisma/200-add-to-existing-project/110-relational-databases/100-connect-your-database-typescript-cockroachdb.mdx b/content/100-getting-started/02-setup-prisma/200-add-to-existing-project/110-relational-databases/100-connect-your-database-typescript-cockroachdb.mdx index 2b59c9683d..61888658e6 100644 --- a/content/100-getting-started/02-setup-prisma/200-add-to-existing-project/110-relational-databases/100-connect-your-database-typescript-cockroachdb.mdx +++ b/content/100-getting-started/02-setup-prisma/200-add-to-existing-project/110-relational-databases/100-connect-your-database-typescript-cockroachdb.mdx @@ -21,7 +21,7 @@ pagination_next: getting-started/setup-prisma/add-to-existing-project/relational To connect your database, you need to set the `url` field of the `datasource` block in your Prisma schema to your database [connection URL](/orm/reference/connection-urls): -```prisma file=prisma/schema.prisma +```prisma file=prisma/schema.prisma showLineNumbers datasource db { provider = "postgresql" url = env("DATABASE_URL") @@ -30,8 +30,9 @@ datasource db { Note that the default schema created by `prisma init` uses PostgreSQL as the `provider`. For CockroachDB, you need to edit the `datasource` block to use the `cockroachdb` provider instead: -```prisma file=prisma/schema.prisma highlight=2;edit +```prisma file=prisma/schema.prisma highlight=2;edit showLineNumbers datasource db { + //edit-next-line provider = "cockroachdb" url = env("DATABASE_URL") } @@ -70,25 +71,3 @@ DATABASE_URL="postgresql://root@localhost:26257?sslmode=disable" ``` Your connection string is displayed as part of the welcome text when starting CockroachDB from the command line. - - - - - Installation - - - - Introspection - - - diff --git a/content/100-getting-started/02-setup-prisma/200-add-to-existing-project/110-relational-databases/100-connect-your-database-typescript-mysql.mdx b/content/100-getting-started/02-setup-prisma/200-add-to-existing-project/110-relational-databases/100-connect-your-database-typescript-mysql.mdx index ab0ad0b1ac..9078c46b8c 100644 --- a/content/100-getting-started/02-setup-prisma/200-add-to-existing-project/110-relational-databases/100-connect-your-database-typescript-mysql.mdx +++ b/content/100-getting-started/02-setup-prisma/200-add-to-existing-project/110-relational-databases/100-connect-your-database-typescript-mysql.mdx @@ -21,7 +21,7 @@ pagination_next: getting-started/setup-prisma/add-to-existing-project/relational To connect your database, you need to set the `url` field of the `datasource` block in your Prisma schema to your database [connection URL](/orm/reference/connection-urls): -```prisma file=prisma/schema.prisma +```prisma file=prisma/schema.prisma showLineNumbers datasource db { provider = "postgresql" url = env("DATABASE_URL") @@ -30,8 +30,9 @@ datasource db { Note that the default schema created by `prisma init` uses PostgreSQL, so you first need to switch the `provider` to `mysql`: -```prisma file=prisma/schema.prisma highlight=2;edit +```prisma file=prisma/schema.prisma highlight=2;edit showLineNumbers datasource db { + //edit-next-line provider = "mysql" url = env("DATABASE_URL") } @@ -72,25 +73,3 @@ When running MySQL locally, your connection URL typically looks similar to this: DATABASE_URL="mysql://root:randompassword@localhost:3306/mydb" ``` - - - - - Installation - - - - Introspection - - - diff --git a/content/100-getting-started/02-setup-prisma/200-add-to-existing-project/110-relational-databases/100-connect-your-database-typescript-planetscale.mdx b/content/100-getting-started/02-setup-prisma/200-add-to-existing-project/110-relational-databases/100-connect-your-database-typescript-planetscale.mdx index e4bac40306..eb2ff05a1c 100644 --- a/content/100-getting-started/02-setup-prisma/200-add-to-existing-project/110-relational-databases/100-connect-your-database-typescript-planetscale.mdx +++ b/content/100-getting-started/02-setup-prisma/200-add-to-existing-project/110-relational-databases/100-connect-your-database-typescript-planetscale.mdx @@ -21,7 +21,7 @@ pagination_next: getting-started/setup-prisma/add-to-existing-project/relational To connect your database, you need to set the `url` field of the `datasource` block in your Prisma schema to your database [connection URL](/orm/reference/connection-urls): -```prisma file=prisma/schema.prisma +```prisma file=prisma/schema.prisma showLineNumbers datasource db { provider = "postgresql" url = env("DATABASE_URL") @@ -30,8 +30,9 @@ datasource db { Note that the default schema created by `prisma init` uses PostgreSQL as the `provider`. For PlanetScale, you need to edit the `datasource` block to use the `mysql` provider instead: -```prisma file=prisma/schema.prisma highlight=2;edit +```prisma file=prisma/schema.prisma highlight=2;edit showLineNumbers datasource db { + //edit-next-line provider = "mysql" url = env("DATABASE_URL") } @@ -39,10 +40,11 @@ datasource db { You will also need to [set the relation mode type to `prisma`](/orm/prisma-schema/data-model/relations/relation-mode#emulate-relations-in-prisma-orm-with-the-prisma-relation-mode) in the `datasource` block: -```prisma file=schema.prisma highlight=4;add +```prisma file=schema.prisma highlight=4;add showLineNumbers datasource db { provider = "mysql" url = env("DATABASE_URL") + //add-next-line relationMode = "prisma" } ``` @@ -96,25 +98,3 @@ pscale connect prisma-test branchname --port PORT The `--port` flag can be omitted if you are using the default port `3306`. - - - - - Installation - - - - Introspection - - - diff --git a/content/100-getting-started/02-setup-prisma/200-add-to-existing-project/110-relational-databases/100-connect-your-database-typescript-postgresql.mdx b/content/100-getting-started/02-setup-prisma/200-add-to-existing-project/110-relational-databases/100-connect-your-database-typescript-postgresql.mdx index 2d45ba1ee3..e2d2be1c2d 100644 --- a/content/100-getting-started/02-setup-prisma/200-add-to-existing-project/110-relational-databases/100-connect-your-database-typescript-postgresql.mdx +++ b/content/100-getting-started/02-setup-prisma/200-add-to-existing-project/110-relational-databases/100-connect-your-database-typescript-postgresql.mdx @@ -20,7 +20,7 @@ pagination_next: getting-started/setup-prisma/add-to-existing-project/relational To connect your database, you need to set the `url` field of the `datasource` block in your Prisma schema to your database [connection URL](/orm/reference/connection-urls): -```prisma file=prisma/schema.prisma +```prisma file=prisma/schema.prisma showLineNumbers datasource db { provider = "postgresql" url = env("DATABASE_URL") @@ -58,25 +58,3 @@ When running PostgreSQL locally on macOS, your user and password as well as the ```bash file=.env DATABASE_URL="postgresql://janedoe:janedoe@localhost:5432/janedoe?schema=hello-prisma" ``` - - - - - Installation - - - - Introspection - - - diff --git a/content/100-getting-started/02-setup-prisma/200-add-to-existing-project/110-relational-databases/100-connect-your-database-typescript-sqlserver.mdx b/content/100-getting-started/02-setup-prisma/200-add-to-existing-project/110-relational-databases/100-connect-your-database-typescript-sqlserver.mdx index c727af30d6..8ca29dfcf9 100644 --- a/content/100-getting-started/02-setup-prisma/200-add-to-existing-project/110-relational-databases/100-connect-your-database-typescript-sqlserver.mdx +++ b/content/100-getting-started/02-setup-prisma/200-add-to-existing-project/110-relational-databases/100-connect-your-database-typescript-sqlserver.mdx @@ -22,7 +22,7 @@ pagination_next: getting-started/setup-prisma/add-to-existing-project/relational To connect your database, you need to set the `url` field of the `datasource` block in your Prisma schema to your database [connection URL](/orm/reference/connection-urls): -```prisma file=prisma/schema.prisma +```prisma file=prisma/schema.prisma showLineNumbers datasource db { provider = "sqlserver" url = env("DATABASE_URL") @@ -38,25 +38,3 @@ DATABASE_URL="sqlserver://localhost:1433;database=mydb;user=sa;password=r@ndomP@ Adjust the connection URL to match your setup - see [Microsoft SQL Server connection URL](/orm/overview/databases/sql-server) for more information. > Make sure TCP/IP connections are enabled via [SQL Server Configuration Manager](https://docs.microsoft.com/en-us/sql/relational-databases/sql-server-configuration-manager) to avoid `No connection could be made because the target machine actively refused it. (os error 10061)` - - - - - Installation - - - - Introspection - - - \ No newline at end of file diff --git a/content/100-getting-started/02-setup-prisma/200-add-to-existing-project/110-relational-databases/150-introspection-node-cockroachdb.mdx b/content/100-getting-started/02-setup-prisma/200-add-to-existing-project/110-relational-databases/150-introspection-node-cockroachdb.mdx index 2a493957a1..b7b9c447d9 100644 --- a/content/100-getting-started/02-setup-prisma/200-add-to-existing-project/110-relational-databases/150-introspection-node-cockroachdb.mdx +++ b/content/100-getting-started/02-setup-prisma/200-add-to-existing-project/110-relational-databases/150-introspection-node-cockroachdb.mdx @@ -97,7 +97,7 @@ After the introspection is complete, your Prisma schema file was updated: The data model now looks similar to this: -```prisma file=prisma/schema.prisma +```prisma file=prisma/schema.prisma showLineNumbers model Post { id BigInt @id @default(autoincrement()) title String @unique @db.String(255) @@ -136,7 +136,7 @@ These changes are relevant for the generated Prisma Client API where using lower Because [relation fields](/orm/prisma-schema/data-model/relations#relation-fields) are _virtual_ (i.e. they _do not directly manifest in the database_), you can manually rename them in your Prisma schema without touching the database: -```prisma file=prisma/schema.prisma highlight=8,15,22,23;edit +```prisma file=prisma/schema.prisma highlight=8,15,22,23;edit showLineNumbers model Post { id BigInt @id @default(autoincrement()) title String @unique @db.String(255) @@ -144,6 +144,7 @@ model Post { content String? published Boolean @default(false) authorId BigInt + //edit-next-line author User @relation(fields: [authorId], references: [id], onDelete: NoAction, onUpdate: NoAction) } @@ -151,6 +152,7 @@ model Profile { id BigInt @id @default(autoincrement()) bio String? userId BigInt @unique + //edit-next-line user User @relation(fields: [userId], references: [id], onDelete: NoAction, onUpdate: NoAction) } @@ -158,8 +160,10 @@ model User { id BigInt @id @default(autoincrement()) name String? @db.String(255) email String @unique @db.String(255) + //edit-start posts Post[] profile Profile? + //edit-end } ``` @@ -218,24 +222,3 @@ Learn more about this on the [Configuring your Prisma Client API](/orm/prisma-cl - - - - Connect your database - - - - Baseline your database - - - diff --git a/content/100-getting-started/02-setup-prisma/200-add-to-existing-project/110-relational-databases/150-introspection-node-mysql.mdx b/content/100-getting-started/02-setup-prisma/200-add-to-existing-project/110-relational-databases/150-introspection-node-mysql.mdx index a68db39c3f..70315959b0 100644 --- a/content/100-getting-started/02-setup-prisma/200-add-to-existing-project/110-relational-databases/150-introspection-node-mysql.mdx +++ b/content/100-getting-started/02-setup-prisma/200-add-to-existing-project/110-relational-databases/150-introspection-node-mysql.mdx @@ -94,7 +94,7 @@ After the introspection is complete, your Prisma schema file was updated: The data model now looks similar to this (note that the fields on the models have been reordered for better readability): -```prisma file=prisma/schema.prisma +```prisma file=prisma/schema.prisma showLineNumbers model Post { id Int @id @default(autoincrement()) title String @db.VarChar(255) @@ -141,7 +141,7 @@ These changes are relevant for the generated Prisma Client API where using lower Because [relation fields](/orm/prisma-schema/data-model/relations#relation-fields) are _virtual_ (i.e. they _do not directly manifest in the database_), you can manually rename them in your Prisma schema without touching the database: -```prisma file=prisma/schema.prisma highlight=8,17,24,25;edit +```prisma file=prisma/schema.prisma highlight=8,17,24,25;edit showLineNumbers model Post { id Int @id @default(autoincrement()) title String @db.VarChar(255) @@ -149,6 +149,7 @@ model Post { content String? @db.Text published Boolean @default(false) authorId Int + //edit-next-line author User @relation(fields: [authorId], references: [id], onDelete: NoAction, onUpdate: NoAction, map: "Post_ibfk_1") @@index([authorId], map: "authorId") @@ -158,6 +159,7 @@ model Profile { id Int @id @default(autoincrement()) bio String? @db.Text userId Int @unique(map: "userId") + //edit-next-line user User @relation(fields: [userId], references: [id], onDelete: NoAction, onUpdate: NoAction, map: "Profile_ibfk_1") } @@ -165,8 +167,10 @@ model User { id Int @id @default(autoincrement()) name String? @db.VarChar(255) email String @unique(map: "email") @db.VarChar(255) + //edit-start posts Post[] profile Profile? + //edit-end } ``` @@ -219,25 +223,3 @@ const user = await prisma.myUser.create({ ``` Learn more about this on the [Configuring your Prisma Client API](/orm/prisma-client/setup-and-configuration/custom-model-and-field-names) page. - - - - - Connect your database - - - - Baseline your database - - - diff --git a/content/100-getting-started/02-setup-prisma/200-add-to-existing-project/110-relational-databases/150-introspection-node-planetscale.mdx b/content/100-getting-started/02-setup-prisma/200-add-to-existing-project/110-relational-databases/150-introspection-node-planetscale.mdx index c71d29d2b8..96821fd322 100644 --- a/content/100-getting-started/02-setup-prisma/200-add-to-existing-project/110-relational-databases/150-introspection-node-planetscale.mdx +++ b/content/100-getting-started/02-setup-prisma/200-add-to-existing-project/110-relational-databases/150-introspection-node-planetscale.mdx @@ -101,7 +101,7 @@ After the introspection is complete, your Prisma schema file was updated: The data model now looks similar to this: -```prisma file=prisma/schema.prisma +```prisma file=prisma/schema.prisma showLineNumbers model Post { id Int @id @default(autoincrement()) createdAt DateTime @default(now()) @@ -139,7 +139,7 @@ Prisma's data model is a declarative representation of your database schema and You will then need to add in any missing relations between your data using [relation fields](/orm/prisma-schema/data-model/relations#relation-fields): -```prisma file=prisma/schema.prisma highlight=8,17,27,28;add +```prisma file=prisma/schema.prisma highlight=8,17,27,28;add showLineNumbers model Post { id Int @id @default(autoincrement()) createdAt DateTime @default(now()) @@ -147,6 +147,7 @@ model Post { title String @db.VarChar(255) content String? published Boolean @default(false) + //add-next-line author User @relation(fields: [authorId], references: [id]) authorId Int @@ -156,6 +157,7 @@ model Post { model Profile { id Int @id @default(autoincrement()) bio String? + //add-next-line user User @relation(fields: [userId], references: [id]) userId Int @unique @@ -166,8 +168,10 @@ model User { id Int @id @default(autoincrement()) email String @unique name String? + //add-start posts Post[] profile Profile? + //add-end } ``` @@ -235,25 +239,3 @@ const user = await prisma.myUser.create({ Learn more about this on the [Configuring your Prisma Client API](/orm/prisma-client/setup-and-configuration/custom-model-and-field-names) page. - - - - - Connect your database - - - - Install Prisma Client - - - diff --git a/content/100-getting-started/02-setup-prisma/200-add-to-existing-project/110-relational-databases/150-introspection-node-postgresql.mdx b/content/100-getting-started/02-setup-prisma/200-add-to-existing-project/110-relational-databases/150-introspection-node-postgresql.mdx index edbc355727..f41225d3fb 100644 --- a/content/100-getting-started/02-setup-prisma/200-add-to-existing-project/110-relational-databases/150-introspection-node-postgresql.mdx +++ b/content/100-getting-started/02-setup-prisma/200-add-to-existing-project/110-relational-databases/150-introspection-node-postgresql.mdx @@ -96,7 +96,7 @@ After the introspection is complete, your Prisma schema file was updated: The data model now looks similar to this (note that the fields on the models have been reordered for better readability): -```prisma file=prisma/schema.prisma +```prisma file=prisma/schema.prisma showLineNumbers model Post { id Int @id @default(autoincrement()) title String @db.VarChar(255) @@ -135,7 +135,7 @@ These changes are relevant for the generated Prisma Client API where using lower Because [relation fields](/orm/prisma-schema/data-model/relations#relation-fields) are _virtual_ (i.e. they _do not directly manifest in the database_), you can manually rename them in your Prisma schema without touching the database: -```prisma file=prisma/schema.prisma highlight=8,15,22,23;edit +```prisma file=prisma/schema.prisma highlight=8,15,22,23;edit showLineNumbers model Post { id Int @id @default(autoincrement()) title String @db.VarChar(255) @@ -143,6 +143,7 @@ model Post { content String? published Boolean @default(false) authorId Int + //edit-next-line author User @relation(fields: [authorId], references: [id], onDelete: NoAction, onUpdate: NoAction) } @@ -150,6 +151,7 @@ model Profile { id Int @id @default(autoincrement()) bio String? userId Int @unique + //edit-next-line user User @relation(fields: [userId], references: [id], onDelete: NoAction, onUpdate: NoAction) } @@ -157,8 +159,10 @@ model User { id Int @id @default(autoincrement()) name String? @db.VarChar(255) email String @unique @db.VarChar(255) + //edit-add posts Post[] profile Profile? + //edit-end } ``` @@ -216,25 +220,3 @@ const user = await prisma.myUser.create({ Learn more about this on the [Configuring your Prisma Client API](/orm/prisma-client/setup-and-configuration/custom-model-and-field-names) page. - - - - - Connect your database - - - - Baseline your database - - - diff --git a/content/100-getting-started/02-setup-prisma/200-add-to-existing-project/110-relational-databases/150-introspection-node-sqlserver.mdx b/content/100-getting-started/02-setup-prisma/200-add-to-existing-project/110-relational-databases/150-introspection-node-sqlserver.mdx index 2700562b1b..6ef75594c7 100644 --- a/content/100-getting-started/02-setup-prisma/200-add-to-existing-project/110-relational-databases/150-introspection-node-sqlserver.mdx +++ b/content/100-getting-started/02-setup-prisma/200-add-to-existing-project/110-relational-databases/150-introspection-node-sqlserver.mdx @@ -103,7 +103,7 @@ After the introspection is complete, your Prisma schema file was updated: The data model now looks similar to this (note that the fields on the models have been reordered for better readability): -```prisma file=prisma/schema.prisma +```prisma file=prisma/schema.prisma showLineNumbers model Post { id Int @id @default(autoincrement()) title String @db.VarChar(255) @@ -142,13 +142,14 @@ These changes are relevant for the generated Prisma Client API where using lower Because [relation fields](/orm/prisma-schema/data-model/relations#relation-fields) are _virtual_ (i.e. they _do not directly manifest in the database_), you can manually rename them in your Prisma schema without touching the database: -```prisma file=prisma/schema.prisma highlight=7,14,22,23;edit +```prisma file=prisma/schema.prisma highlight=7,14,22,23;edit showLineNumbers model Post { id Int @id @default(autoincrement()) title String @db.VarChar(255) createdAt DateTime @default(now()) @db.Timestamp(6) content String? published Boolean @default(false) + //edit-next-line author User @relation(fields: [authorId], references: [id]) authorId Int } @@ -156,6 +157,7 @@ model Post { model Profile { id Int @id @default(autoincrement()) bio String? + //edit-next-line user User @relation(fields: [userId], references: [id]) userId Int @unique } @@ -164,8 +166,10 @@ model User { id Int @id @default(autoincrement()) email String @unique @db.VarChar(255) name String? @db.VarChar(255) + //edit-start posts Post[] profile Profile? + //edit-end } ``` @@ -223,25 +227,3 @@ const user = await prisma.myUser.create({ Learn more about this on the [Configuring your Prisma Client API](/orm/prisma-client/setup-and-configuration/custom-model-and-field-names) page. - - - - - Connect your database - - - - Baseline your database - - - diff --git a/content/100-getting-started/02-setup-prisma/200-add-to-existing-project/110-relational-databases/150-introspection-typescript-cockroachdb.mdx b/content/100-getting-started/02-setup-prisma/200-add-to-existing-project/110-relational-databases/150-introspection-typescript-cockroachdb.mdx index d3ecb6b2a7..7827c8c6a9 100644 --- a/content/100-getting-started/02-setup-prisma/200-add-to-existing-project/110-relational-databases/150-introspection-typescript-cockroachdb.mdx +++ b/content/100-getting-started/02-setup-prisma/200-add-to-existing-project/110-relational-databases/150-introspection-typescript-cockroachdb.mdx @@ -96,7 +96,7 @@ After the introspection is complete, your Prisma schema file was updated: The data model now looks similar to this: -```prisma file=prisma/schema.prisma +```prisma file=prisma/schema.prisma showLineNumbers model Post { id BigInt @id @default(autoincrement()) title String @unique @db.String(255) @@ -135,7 +135,7 @@ These changes are relevant for the generated Prisma Client API where using lower Because [relation fields](/orm/prisma-schema/data-model/relations#relation-fields) are _virtual_ (i.e. they _do not directly manifest in the database_), you can manually rename them in your Prisma schema without touching the database: -```prisma file=prisma/schema.prisma highlight=8,15,22,23;edit +```prisma file=prisma/schema.prisma highlight=8,15,22,23;edit showLineNumbers model Post { id BigInt @id @default(autoincrement()) title String @unique @db.String(255) @@ -143,6 +143,7 @@ model Post { content String? published Boolean @default(false) authorId BigInt + //edit-next-line author User @relation(fields: [authorId], references: [id], onDelete: NoAction, onUpdate: NoAction) } @@ -150,6 +151,7 @@ model Profile { id BigInt @id @default(autoincrement()) bio String? userId BigInt @unique + //edit-next-line user User @relation(fields: [userId], references: [id], onDelete: NoAction, onUpdate: NoAction) } @@ -157,8 +159,10 @@ model User { id BigInt @id @default(autoincrement()) name String? @db.String(255) email String @unique @db.String(255) + //edit-start posts Post[] profile Profile? + //edit-end } ``` @@ -216,25 +220,3 @@ const user = await prisma.myUser.create({ Learn more about this on the [Configuring your Prisma Client API](/orm/prisma-client/setup-and-configuration/custom-model-and-field-names) page. - - - - - Connect your database - - - - Baseline your database - - - diff --git a/content/100-getting-started/02-setup-prisma/200-add-to-existing-project/110-relational-databases/150-introspection-typescript-mysql.mdx b/content/100-getting-started/02-setup-prisma/200-add-to-existing-project/110-relational-databases/150-introspection-typescript-mysql.mdx index 138c1a963b..209275468f 100644 --- a/content/100-getting-started/02-setup-prisma/200-add-to-existing-project/110-relational-databases/150-introspection-typescript-mysql.mdx +++ b/content/100-getting-started/02-setup-prisma/200-add-to-existing-project/110-relational-databases/150-introspection-typescript-mysql.mdx @@ -94,7 +94,7 @@ After the introspection is complete, your Prisma schema file was updated: The data model now looks similar to this (note that the fields on the models have been reordered for better readability): -```prisma file=prisma/schema.prisma +```prisma file=prisma/schema.prisma showLineNumbers model Post { id Int @id @default(autoincrement()) title String @db.VarChar(255) @@ -141,7 +141,7 @@ These changes are relevant for the generated Prisma Client API where using lower Because [relation fields](/orm/prisma-schema/data-model/relations#relation-fields) are _virtual_ (i.e. they _do not directly manifest in the database_), you can manually rename them in your Prisma schema without touching the database: -```prisma file=prisma/schema.prisma highlight=8,17,24,25;edit +```prisma file=prisma/schema.prisma highlight=8,17,24,25;edit showLineNumbers model Post { id Int @id @default(autoincrement()) title String @db.VarChar(255) @@ -149,6 +149,7 @@ model Post { content String? @db.Text published Boolean @default(false) authorId Int + //edit-next-line author User @relation(fields: [authorId], references: [id], onDelete: NoAction, onUpdate: NoAction, map: "Post_ibfk_1") @@index([authorId], map: "authorId") @@ -158,6 +159,7 @@ model Profile { id Int @id @default(autoincrement()) bio String? @db.Text userId Int @unique(map: "userId") + //edit-next-line user User @relation(fields: [userId], references: [id], onDelete: NoAction, onUpdate: NoAction, map: "Profile_ibfk_1") } @@ -165,8 +167,10 @@ model User { id Int @id @default(autoincrement()) name String? @db.VarChar(255) email String @unique(map: "email") @db.VarChar(255) + //edit-start posts Post[] profile Profile? + //edit-end } ``` @@ -219,25 +223,3 @@ const user = await prisma.myUser.create({ ``` Learn more about this on the [Configuring your Prisma Client API](/orm/prisma-client/setup-and-configuration/custom-model-and-field-names) page. - - - - - Connect your database - - - - Baseline your database - - - diff --git a/content/100-getting-started/02-setup-prisma/200-add-to-existing-project/110-relational-databases/150-introspection-typescript-planetscale.mdx b/content/100-getting-started/02-setup-prisma/200-add-to-existing-project/110-relational-databases/150-introspection-typescript-planetscale.mdx index 4fa3fccad1..ce7917ff4e 100644 --- a/content/100-getting-started/02-setup-prisma/200-add-to-existing-project/110-relational-databases/150-introspection-typescript-planetscale.mdx +++ b/content/100-getting-started/02-setup-prisma/200-add-to-existing-project/110-relational-databases/150-introspection-typescript-planetscale.mdx @@ -101,7 +101,7 @@ After the introspection is complete, your Prisma schema file was updated: The data model now looks similar to this: -```prisma file=prisma/schema.prisma +```prisma file=prisma/schema.prisma showLineNumbers model Post { id Int @id @default(autoincrement()) createdAt DateTime @default(now()) @@ -139,7 +139,7 @@ Prisma's data model is a declarative representation of your database schema and You will then need to add in any missing relations between your data using [relation fields](/orm/prisma-schema/data-model/relations#relation-fields): -```prisma file=prisma/schema.prisma highlight=8,17,27,28;add +```prisma file=prisma/schema.prisma highlight=8,17,27,28;add showLineNumbers model Post { id Int @id @default(autoincrement()) createdAt DateTime @default(now()) @@ -147,6 +147,7 @@ model Post { title String @db.VarChar(255) content String? published Boolean @default(false) + //add-next-line author User @relation(fields: [authorId], references: [id]) authorId Int @@ -156,6 +157,7 @@ model Post { model Profile { id Int @id @default(autoincrement()) bio String? + //add-next-line user User @relation(fields: [userId], references: [id]) userId Int @unique @@ -166,8 +168,10 @@ model User { id Int @id @default(autoincrement()) email String @unique name String? + //add-start posts Post[] profile Profile? + //add-end } ``` @@ -235,25 +239,3 @@ const user = await prisma.myUser.create({ Learn more about this on the [Configuring your Prisma Client API](/orm/prisma-client/setup-and-configuration/custom-model-and-field-names) page. - - - - - Connect your database - - - - Install Prisma Client - - - diff --git a/content/100-getting-started/02-setup-prisma/200-add-to-existing-project/110-relational-databases/150-introspection-typescript-postgresql.mdx b/content/100-getting-started/02-setup-prisma/200-add-to-existing-project/110-relational-databases/150-introspection-typescript-postgresql.mdx index 1f1330c7d4..fa88cadfdc 100644 --- a/content/100-getting-started/02-setup-prisma/200-add-to-existing-project/110-relational-databases/150-introspection-typescript-postgresql.mdx +++ b/content/100-getting-started/02-setup-prisma/200-add-to-existing-project/110-relational-databases/150-introspection-typescript-postgresql.mdx @@ -95,7 +95,7 @@ After the introspection is complete, your Prisma schema file was updated: The data model now looks similar to this (note that the fields on the models have been reordered for better readability): -```prisma file=prisma/schema.prisma +```prisma file=prisma/schema.prisma showLineNumbers model Post { id Int @id @default(autoincrement()) title String @db.VarChar(255) @@ -134,7 +134,7 @@ These changes are relevant for the generated Prisma Client API where using lower Because [relation fields](/orm/prisma-schema/data-model/relations#relation-fields) are _virtual_ (i.e. they _do not directly manifest in the database_), you can manually rename them in your Prisma schema without touching the database: -```prisma file=prisma/schema.prisma highlight=8,15,22,23;edit +```prisma file=prisma/schema.prisma highlight=8,15,22,23;edit showLineNumbers model Post { id Int @id @default(autoincrement()) title String @db.VarChar(255) @@ -142,6 +142,7 @@ model Post { content String? published Boolean @default(false) authorId Int + //edit-next-line author User @relation(fields: [authorId], references: [id], onDelete: NoAction, onUpdate: NoAction) } @@ -149,6 +150,7 @@ model Profile { id Int @id @default(autoincrement()) bio String? userId Int @unique + //edit-next-line user User @relation(fields: [userId], references: [id], onDelete: NoAction, onUpdate: NoAction) } @@ -156,8 +158,10 @@ model User { id Int @id @default(autoincrement()) name String? @db.VarChar(255) email String @unique @db.VarChar(255) + //edit-start posts Post[] profile Profile? + //edit-end } ``` @@ -215,25 +219,3 @@ const user = await prisma.myUser.create({ Learn more about this on the [Configuring your Prisma Client API](/orm/prisma-client/setup-and-configuration/custom-model-and-field-names) page. - - - - - Connect your database - - - - Baseline your database - - - diff --git a/content/100-getting-started/02-setup-prisma/200-add-to-existing-project/110-relational-databases/150-introspection-typescript-sqlserver.mdx b/content/100-getting-started/02-setup-prisma/200-add-to-existing-project/110-relational-databases/150-introspection-typescript-sqlserver.mdx index f2d7978b17..e4a3cb008d 100644 --- a/content/100-getting-started/02-setup-prisma/200-add-to-existing-project/110-relational-databases/150-introspection-typescript-sqlserver.mdx +++ b/content/100-getting-started/02-setup-prisma/200-add-to-existing-project/110-relational-databases/150-introspection-typescript-sqlserver.mdx @@ -103,7 +103,7 @@ After the introspection is complete, your Prisma schema file was updated: The data model now looks similar to this (note that the fields on the models have been reordered for better readability): -```prisma file=prisma/schema.prisma +```prisma file=prisma/schema.prisma showLineNumbers model Post { id Int @id @default(autoincrement()) title String @db.VarChar(255) @@ -142,13 +142,14 @@ These changes are relevant for the generated Prisma Client API where using lower Because [relation fields](/orm/prisma-schema/data-model/relations#relation-fields) are _virtual_ (i.e. they _do not directly manifest in the database_), you can manually rename them in your Prisma schema without touching the database: -```prisma file=prisma/schema.prisma highlight=7,14,22,23;edit +```prisma file=prisma/schema.prisma highlight=7,14,22,23;edit showLineNumbers model Post { id Int @id @default(autoincrement()) title String @db.VarChar(255) createdAt DateTime @default(now()) @db.Timestamp(6) content String? published Boolean @default(false) + //edit-next-line author User @relation(fields: [authorId], references: [id]) authorId Int } @@ -156,6 +157,7 @@ model Post { model Profile { id Int @id @default(autoincrement()) bio String? + //edit-next-line user User @relation(fields: [userId], references: [id]) userId Int @unique } @@ -164,8 +166,10 @@ model User { id Int @id @default(autoincrement()) email String @unique @db.VarChar(255) name String? @db.VarChar(255) + //edit-start posts Post[] profile Profile? + //edit-end } ``` @@ -223,25 +227,3 @@ const user = await prisma.myUser.create({ Learn more about this on the [Configuring your Prisma Client API](/orm/prisma-client/setup-and-configuration/custom-model-and-field-names) page. - - - - - Connect your database - - - - Baseline your database - - - diff --git a/content/100-getting-started/02-setup-prisma/200-add-to-existing-project/110-relational-databases/170-baseline-your-database-node-cockroachdb.mdx b/content/100-getting-started/02-setup-prisma/200-add-to-existing-project/110-relational-databases/170-baseline-your-database-node-cockroachdb.mdx index cd6b3abcec..469b434da2 100644 --- a/content/100-getting-started/02-setup-prisma/200-add-to-existing-project/110-relational-databases/170-baseline-your-database-node-cockroachdb.mdx +++ b/content/100-getting-started/02-setup-prisma/200-add-to-existing-project/110-relational-databases/170-baseline-your-database-node-cockroachdb.mdx @@ -87,25 +87,3 @@ npx prisma migrate resolve --applied 0_init The command will mark `0_init` as applied by adding it to the `_prisma_migrations` table. You now have a baseline for your current database schema. To make further changes to your database schema, you can update your Prisma schema and use `prisma migrate dev` to apply the changes to your database. - - - - - Introspection - - - - Install Prisma Client - - - diff --git a/content/100-getting-started/02-setup-prisma/200-add-to-existing-project/110-relational-databases/170-baseline-your-database-node-mysql.mdx b/content/100-getting-started/02-setup-prisma/200-add-to-existing-project/110-relational-databases/170-baseline-your-database-node-mysql.mdx index 78cf5af3c7..c77a86da0e 100644 --- a/content/100-getting-started/02-setup-prisma/200-add-to-existing-project/110-relational-databases/170-baseline-your-database-node-mysql.mdx +++ b/content/100-getting-started/02-setup-prisma/200-add-to-existing-project/110-relational-databases/170-baseline-your-database-node-mysql.mdx @@ -103,25 +103,3 @@ npx prisma migrate resolve --applied 0_init The command will mark `0_init` as applied by adding it to the `_prisma_migrations` table. You now have a baseline for your current database schema. To make further changes to your database schema, you can update your Prisma schema and use `prisma migrate dev` to apply the changes to your database. - - - - - Introspection - - - - Install Prisma Client - - - diff --git a/content/100-getting-started/02-setup-prisma/200-add-to-existing-project/110-relational-databases/170-baseline-your-database-node-postgresql.mdx b/content/100-getting-started/02-setup-prisma/200-add-to-existing-project/110-relational-databases/170-baseline-your-database-node-postgresql.mdx index b877ec6014..d3896f99e6 100644 --- a/content/100-getting-started/02-setup-prisma/200-add-to-existing-project/110-relational-databases/170-baseline-your-database-node-postgresql.mdx +++ b/content/100-getting-started/02-setup-prisma/200-add-to-existing-project/110-relational-databases/170-baseline-your-database-node-postgresql.mdx @@ -106,25 +106,3 @@ npx prisma migrate resolve --applied 0_init The command will mark `0_init` as applied by adding it to the `_prisma_migrations` table. You now have a baseline for your current database schema. To make further changes to your database schema, you can update your Prisma schema and use `prisma migrate dev` to apply the changes to your database. - - - - - Introspection - - - - Install Prisma Client - - - diff --git a/content/100-getting-started/02-setup-prisma/200-add-to-existing-project/110-relational-databases/170-baseline-your-database-node-sqlserver.mdx b/content/100-getting-started/02-setup-prisma/200-add-to-existing-project/110-relational-databases/170-baseline-your-database-node-sqlserver.mdx index 1880d78e90..9c420fb013 100644 --- a/content/100-getting-started/02-setup-prisma/200-add-to-existing-project/110-relational-databases/170-baseline-your-database-node-sqlserver.mdx +++ b/content/100-getting-started/02-setup-prisma/200-add-to-existing-project/110-relational-databases/170-baseline-your-database-node-sqlserver.mdx @@ -95,25 +95,3 @@ npx prisma migrate resolve --applied 0_init The command will mark `0_init` as applied by adding it to the `_prisma_migrations` table. You now have a baseline for your current database schema. To make further changes to your database schema, you can update your Prisma schema and use `prisma migrate dev` to apply the changes to your database. - - - - - Introspection - - - - Install Prisma Client - - - diff --git a/content/100-getting-started/02-setup-prisma/200-add-to-existing-project/110-relational-databases/170-baseline-your-database-typescript-cockroachdb.mdx b/content/100-getting-started/02-setup-prisma/200-add-to-existing-project/110-relational-databases/170-baseline-your-database-typescript-cockroachdb.mdx index a7f3054a50..fe1ffc329a 100644 --- a/content/100-getting-started/02-setup-prisma/200-add-to-existing-project/110-relational-databases/170-baseline-your-database-typescript-cockroachdb.mdx +++ b/content/100-getting-started/02-setup-prisma/200-add-to-existing-project/110-relational-databases/170-baseline-your-database-typescript-cockroachdb.mdx @@ -76,25 +76,3 @@ CREATE TABLE "Profile" ( FOREIGN KEY ("userId") REFERENCES "User"(id) ); ``` - - - - - Introspection - - - - Install Prisma Client - - - diff --git a/content/100-getting-started/02-setup-prisma/200-add-to-existing-project/110-relational-databases/170-baseline-your-database-typescript-mysql.mdx b/content/100-getting-started/02-setup-prisma/200-add-to-existing-project/110-relational-databases/170-baseline-your-database-typescript-mysql.mdx index 9596922f89..f85a99dc6e 100644 --- a/content/100-getting-started/02-setup-prisma/200-add-to-existing-project/110-relational-databases/170-baseline-your-database-typescript-mysql.mdx +++ b/content/100-getting-started/02-setup-prisma/200-add-to-existing-project/110-relational-databases/170-baseline-your-database-typescript-mysql.mdx @@ -104,25 +104,3 @@ npx prisma migrate resolve --applied 0_init The command will mark `0_init` as applied by adding it to the `_prisma_migrations` table. You now have a baseline for your current database schema. To make further changes to your database schema, you can update your Prisma schema and use `prisma migrate dev` to apply the changes to your database. - - - - - Introspection - - - - Install Prisma Client - - - diff --git a/content/100-getting-started/02-setup-prisma/200-add-to-existing-project/110-relational-databases/170-baseline-your-database-typescript-postgresql.mdx b/content/100-getting-started/02-setup-prisma/200-add-to-existing-project/110-relational-databases/170-baseline-your-database-typescript-postgresql.mdx index cc34251443..30ebd5b36e 100644 --- a/content/100-getting-started/02-setup-prisma/200-add-to-existing-project/110-relational-databases/170-baseline-your-database-typescript-postgresql.mdx +++ b/content/100-getting-started/02-setup-prisma/200-add-to-existing-project/110-relational-databases/170-baseline-your-database-typescript-postgresql.mdx @@ -105,25 +105,3 @@ npx prisma migrate resolve --applied 0_init The command will mark `0_init` as applied by adding it to the `_prisma_migrations` table. You now have a baseline for your current database schema. To make further changes to your database schema, you can update your Prisma schema and use `prisma migrate dev` to apply the changes to your database. - - - - - Introspection - - - - Install Prisma Client - - - diff --git a/content/100-getting-started/02-setup-prisma/200-add-to-existing-project/110-relational-databases/170-baseline-your-database-typescript-sqlserver.mdx b/content/100-getting-started/02-setup-prisma/200-add-to-existing-project/110-relational-databases/170-baseline-your-database-typescript-sqlserver.mdx index a0dd6ff651..10a1ad3b95 100644 --- a/content/100-getting-started/02-setup-prisma/200-add-to-existing-project/110-relational-databases/170-baseline-your-database-typescript-sqlserver.mdx +++ b/content/100-getting-started/02-setup-prisma/200-add-to-existing-project/110-relational-databases/170-baseline-your-database-typescript-sqlserver.mdx @@ -95,25 +95,3 @@ npx prisma migrate resolve --applied 0_init The command will mark `0_init` as applied by adding it to the `_prisma_migrations` table. You now have a baseline for your current database schema. To make further changes to your database schema, you can update your Prisma schema and use `prisma migrate dev` to apply the changes to your database. - - - - - Introspection - - - - Install Prisma Client - - - diff --git a/content/100-getting-started/02-setup-prisma/200-add-to-existing-project/110-relational-databases/200-install-prisma-client-node-cockroachdb.mdx b/content/100-getting-started/02-setup-prisma/200-add-to-existing-project/110-relational-databases/200-install-prisma-client-node-cockroachdb.mdx index 82c24ee31b..5278a26d08 100644 --- a/content/100-getting-started/02-setup-prisma/200-add-to-existing-project/110-relational-databases/200-install-prisma-client-node-cockroachdb.mdx +++ b/content/100-getting-started/02-setup-prisma/200-add-to-existing-project/110-relational-databases/200-install-prisma-client-node-cockroachdb.mdx @@ -39,25 +39,3 @@ This command reads your Prisma schema and generates your Prisma Client library: The `@prisma/client` node module references a folder named `.prisma/client`, which contains your unique, generated Prisma Client: ![The .prisma and @prisma folders](/img/getting-started/prisma-client-node-module.png) - - - - - Baseline your database - - - - Querying the database - - - diff --git a/content/100-getting-started/02-setup-prisma/200-add-to-existing-project/110-relational-databases/200-install-prisma-client-node-mysql.mdx b/content/100-getting-started/02-setup-prisma/200-add-to-existing-project/110-relational-databases/200-install-prisma-client-node-mysql.mdx index 68ccc7d952..bb26346072 100644 --- a/content/100-getting-started/02-setup-prisma/200-add-to-existing-project/110-relational-databases/200-install-prisma-client-node-mysql.mdx +++ b/content/100-getting-started/02-setup-prisma/200-add-to-existing-project/110-relational-databases/200-install-prisma-client-node-mysql.mdx @@ -39,25 +39,3 @@ This command reads your Prisma schema and generates your Prisma Client library: The `@prisma/client` node module references a folder named `.prisma/client`, which contains your unique, generated Prisma Client: ![The .prisma and @prisma folders](/img/getting-started/prisma-client-node-module.png) - - - - - Baseline your database - - - - Querying the database - - - diff --git a/content/100-getting-started/02-setup-prisma/200-add-to-existing-project/110-relational-databases/200-install-prisma-client-node-planetscale.mdx b/content/100-getting-started/02-setup-prisma/200-add-to-existing-project/110-relational-databases/200-install-prisma-client-node-planetscale.mdx index 121ee41c17..f4373e2e7d 100644 --- a/content/100-getting-started/02-setup-prisma/200-add-to-existing-project/110-relational-databases/200-install-prisma-client-node-planetscale.mdx +++ b/content/100-getting-started/02-setup-prisma/200-add-to-existing-project/110-relational-databases/200-install-prisma-client-node-planetscale.mdx @@ -39,25 +39,3 @@ This command reads your Prisma schema and generates your Prisma Client library: The `@prisma/client` node module references a folder named `.prisma/client`, which contains your unique, generated Prisma Client: ![The .prisma and @prisma folders](/img/getting-started/prisma-client-node-module.png) - - - - - Introspection - - - - Querying the database - - - diff --git a/content/100-getting-started/02-setup-prisma/200-add-to-existing-project/110-relational-databases/200-install-prisma-client-node-postgresql.mdx b/content/100-getting-started/02-setup-prisma/200-add-to-existing-project/110-relational-databases/200-install-prisma-client-node-postgresql.mdx index d5aa0734be..66c63dc180 100644 --- a/content/100-getting-started/02-setup-prisma/200-add-to-existing-project/110-relational-databases/200-install-prisma-client-node-postgresql.mdx +++ b/content/100-getting-started/02-setup-prisma/200-add-to-existing-project/110-relational-databases/200-install-prisma-client-node-postgresql.mdx @@ -39,25 +39,3 @@ This command reads your Prisma schema and generates your Prisma Client library: The `@prisma/client` node module references a folder named `.prisma/client`, which contains your unique, generated Prisma Client: ![The .prisma and @prisma folders](/img/getting-started/prisma-client-node-module.png) - - - - - Baseline your database - - - - Querying the database - - - diff --git a/content/100-getting-started/02-setup-prisma/200-add-to-existing-project/110-relational-databases/200-install-prisma-client-node-sqlserver.mdx b/content/100-getting-started/02-setup-prisma/200-add-to-existing-project/110-relational-databases/200-install-prisma-client-node-sqlserver.mdx index 823cbc6445..a7a2c199af 100644 --- a/content/100-getting-started/02-setup-prisma/200-add-to-existing-project/110-relational-databases/200-install-prisma-client-node-sqlserver.mdx +++ b/content/100-getting-started/02-setup-prisma/200-add-to-existing-project/110-relational-databases/200-install-prisma-client-node-sqlserver.mdx @@ -39,25 +39,3 @@ This command reads your Prisma schema and generates your Prisma Client library: The `@prisma/client` node module references a folder named `.prisma/client`, which contains your unique, generated Prisma Client: ![The .prisma and @prisma folders](/img/getting-started/prisma-client-node-module.png) - - - - - Baseline your database - - - - Querying the database - - - diff --git a/content/100-getting-started/02-setup-prisma/200-add-to-existing-project/110-relational-databases/200-install-prisma-client-typescript-cockroachdb.mdx b/content/100-getting-started/02-setup-prisma/200-add-to-existing-project/110-relational-databases/200-install-prisma-client-typescript-cockroachdb.mdx index f32edf80ce..dd042bd4be 100644 --- a/content/100-getting-started/02-setup-prisma/200-add-to-existing-project/110-relational-databases/200-install-prisma-client-typescript-cockroachdb.mdx +++ b/content/100-getting-started/02-setup-prisma/200-add-to-existing-project/110-relational-databases/200-install-prisma-client-typescript-cockroachdb.mdx @@ -39,25 +39,3 @@ This command reads your Prisma schema and generates your Prisma Client library: The `@prisma/client` node module references a folder named `.prisma/client`, which contains your unique, generated Prisma Client: ![The .prisma and @prisma folders](/img/getting-started/prisma-client-node-module.png) - - - - - Baseline your database - - - - Querying the database - - - diff --git a/content/100-getting-started/02-setup-prisma/200-add-to-existing-project/110-relational-databases/200-install-prisma-client-typescript-mysql.mdx b/content/100-getting-started/02-setup-prisma/200-add-to-existing-project/110-relational-databases/200-install-prisma-client-typescript-mysql.mdx index d2fb1c3205..750bce1e10 100644 --- a/content/100-getting-started/02-setup-prisma/200-add-to-existing-project/110-relational-databases/200-install-prisma-client-typescript-mysql.mdx +++ b/content/100-getting-started/02-setup-prisma/200-add-to-existing-project/110-relational-databases/200-install-prisma-client-typescript-mysql.mdx @@ -39,25 +39,3 @@ This command reads your Prisma schema and generates your Prisma Client library: The `@prisma/client` node module references a folder named `.prisma/client`, which contains your unique, generated Prisma Client: ![The .prisma and @prisma folders](/img/getting-started/prisma-client-node-module.png) - - - - - Baseline your database - - - - Querying the database - - - diff --git a/content/100-getting-started/02-setup-prisma/200-add-to-existing-project/110-relational-databases/200-install-prisma-client-typescript-planetscale.mdx b/content/100-getting-started/02-setup-prisma/200-add-to-existing-project/110-relational-databases/200-install-prisma-client-typescript-planetscale.mdx index c24085b441..784cc64398 100644 --- a/content/100-getting-started/02-setup-prisma/200-add-to-existing-project/110-relational-databases/200-install-prisma-client-typescript-planetscale.mdx +++ b/content/100-getting-started/02-setup-prisma/200-add-to-existing-project/110-relational-databases/200-install-prisma-client-typescript-planetscale.mdx @@ -39,25 +39,3 @@ This command reads your Prisma schema and generates your Prisma Client library: The `@prisma/client` node module references a folder named `.prisma/client`, which contains your unique, generated Prisma Client: ![The .prisma and @prisma folders](/img/getting-started/prisma-client-node-module.png) - - - - - Introspection - - - - Querying the database - - - diff --git a/content/100-getting-started/02-setup-prisma/200-add-to-existing-project/110-relational-databases/200-install-prisma-client-typescript-postgresql.mdx b/content/100-getting-started/02-setup-prisma/200-add-to-existing-project/110-relational-databases/200-install-prisma-client-typescript-postgresql.mdx index 67291084cc..6a69d01eb2 100644 --- a/content/100-getting-started/02-setup-prisma/200-add-to-existing-project/110-relational-databases/200-install-prisma-client-typescript-postgresql.mdx +++ b/content/100-getting-started/02-setup-prisma/200-add-to-existing-project/110-relational-databases/200-install-prisma-client-typescript-postgresql.mdx @@ -38,25 +38,3 @@ This command reads your Prisma schema and generates your Prisma Client library: The `@prisma/client` node module references a folder named `.prisma/client`, which contains your unique, generated Prisma Client: ![The .prisma and @prisma folders](/img/getting-started/prisma-client-node-module.png) - - - - - Baseline your database - - - - Querying the database - - - diff --git a/content/100-getting-started/02-setup-prisma/200-add-to-existing-project/110-relational-databases/200-install-prisma-client-typescript-sqlserver.mdx b/content/100-getting-started/02-setup-prisma/200-add-to-existing-project/110-relational-databases/200-install-prisma-client-typescript-sqlserver.mdx index cfe36d32d6..26f3ace659 100644 --- a/content/100-getting-started/02-setup-prisma/200-add-to-existing-project/110-relational-databases/200-install-prisma-client-typescript-sqlserver.mdx +++ b/content/100-getting-started/02-setup-prisma/200-add-to-existing-project/110-relational-databases/200-install-prisma-client-typescript-sqlserver.mdx @@ -39,25 +39,3 @@ This command reads your Prisma schema and generates your Prisma Client library: The `@prisma/client` node module references a folder named `.prisma/client`, which contains your unique, generated Prisma Client: ![The .prisma and @prisma folders](/img/getting-started/prisma-client-node-module.png) - - - - - Baseline your database - - - - Querying the database - - - diff --git a/content/100-getting-started/02-setup-prisma/200-add-to-existing-project/110-relational-databases/250-querying-the-database-node-cockroachdb.mdx b/content/100-getting-started/02-setup-prisma/200-add-to-existing-project/110-relational-databases/250-querying-the-database-node-cockroachdb.mdx index ee304dfffc..b4359c92a6 100644 --- a/content/100-getting-started/02-setup-prisma/200-add-to-existing-project/110-relational-databases/250-querying-the-database-node-cockroachdb.mdx +++ b/content/100-getting-started/02-setup-prisma/200-add-to-existing-project/110-relational-databases/250-querying-the-database-node-cockroachdb.mdx @@ -125,25 +125,3 @@ Now run the code using the same command as before: ```terminal copy node index.js ``` - - - - - Install Prisma Client - - - - Evolve your schema - - - diff --git a/content/100-getting-started/02-setup-prisma/200-add-to-existing-project/110-relational-databases/250-querying-the-database-node-mysql.mdx b/content/100-getting-started/02-setup-prisma/200-add-to-existing-project/110-relational-databases/250-querying-the-database-node-mysql.mdx index 347acc1e1b..fd188aaeb3 100644 --- a/content/100-getting-started/02-setup-prisma/200-add-to-existing-project/110-relational-databases/250-querying-the-database-node-mysql.mdx +++ b/content/100-getting-started/02-setup-prisma/200-add-to-existing-project/110-relational-databases/250-querying-the-database-node-mysql.mdx @@ -127,25 +127,3 @@ Now run the code using the same command as before: ```terminal copy node index.js ``` - - - - - Install Prisma Client - - - - Evolve your schema - - - diff --git a/content/100-getting-started/02-setup-prisma/200-add-to-existing-project/110-relational-databases/250-querying-the-database-node-planetscale.mdx b/content/100-getting-started/02-setup-prisma/200-add-to-existing-project/110-relational-databases/250-querying-the-database-node-planetscale.mdx index c404c19dc9..7fc2523431 100644 --- a/content/100-getting-started/02-setup-prisma/200-add-to-existing-project/110-relational-databases/250-querying-the-database-node-planetscale.mdx +++ b/content/100-getting-started/02-setup-prisma/200-add-to-existing-project/110-relational-databases/250-querying-the-database-node-planetscale.mdx @@ -139,24 +139,3 @@ Now run the code using the same command as before: ```terminal copy node index.js ``` - - - - - Install Prisma Client - - - Next Steps - - - diff --git a/content/100-getting-started/02-setup-prisma/200-add-to-existing-project/110-relational-databases/250-querying-the-database-node-postgresql.mdx b/content/100-getting-started/02-setup-prisma/200-add-to-existing-project/110-relational-databases/250-querying-the-database-node-postgresql.mdx index 4188a3ec2b..b66725fe9e 100644 --- a/content/100-getting-started/02-setup-prisma/200-add-to-existing-project/110-relational-databases/250-querying-the-database-node-postgresql.mdx +++ b/content/100-getting-started/02-setup-prisma/200-add-to-existing-project/110-relational-databases/250-querying-the-database-node-postgresql.mdx @@ -126,25 +126,3 @@ Now run the code using the same command as before: ```terminal copy node index.js ``` - - - - - Install Prisma Client - - - - Evolve your schema - - - diff --git a/content/100-getting-started/02-setup-prisma/200-add-to-existing-project/110-relational-databases/250-querying-the-database-node-sqlserver.mdx b/content/100-getting-started/02-setup-prisma/200-add-to-existing-project/110-relational-databases/250-querying-the-database-node-sqlserver.mdx index 6f0d0783b1..dd75e69f68 100644 --- a/content/100-getting-started/02-setup-prisma/200-add-to-existing-project/110-relational-databases/250-querying-the-database-node-sqlserver.mdx +++ b/content/100-getting-started/02-setup-prisma/200-add-to-existing-project/110-relational-databases/250-querying-the-database-node-sqlserver.mdx @@ -134,25 +134,3 @@ async function main() { console.log(post) } ``` - - - - - Install Prisma Client - - - - Evolve your schema - - - diff --git a/content/100-getting-started/02-setup-prisma/200-add-to-existing-project/110-relational-databases/250-querying-the-database-typescript-cockroachdb.mdx b/content/100-getting-started/02-setup-prisma/200-add-to-existing-project/110-relational-databases/250-querying-the-database-typescript-cockroachdb.mdx index 314b54596b..41f7d44449 100644 --- a/content/100-getting-started/02-setup-prisma/200-add-to-existing-project/110-relational-databases/250-querying-the-database-typescript-cockroachdb.mdx +++ b/content/100-getting-started/02-setup-prisma/200-add-to-existing-project/110-relational-databases/250-querying-the-database-typescript-cockroachdb.mdx @@ -27,7 +27,7 @@ For the purpose of this guide however, you'll just create a plain Node.js script Create a new file named `index.ts` and add the following code to it: -```ts file=index.ts +```ts file=index.ts showLineNumbers import { PrismaClient } from '@prisma/client' const prisma = new PrismaClient() @@ -61,7 +61,7 @@ The following examples are all based on the models in the Prisma schema. Inside the `main` function, add the following query to read all `User` records from the database and print the result: -```ts file=index.ts +```ts file=index.ts showLineNumbers async function main() { const allUsers = await prisma.user.findMany() console.log(allUsers) @@ -88,7 +88,7 @@ The `findMany` query you used in the previous section only _reads_ data from the Adjust the `main` function to send a `create` query to the database: -```ts file=index.ts +```ts file=index.ts showLineNumbers async function main() { await prisma.user.create({ data: { @@ -125,7 +125,7 @@ npx ts-node index.ts Before moving on to the next section, you'll "publish" the `Post` record you just created using an `update` query. Adjust the `main` function as follows: -```ts file=index.ts +```ts file=index.ts showLineNumbers async function main() { const post = await prisma.post.update({ where: { title: 'Hello World' }, @@ -141,24 +141,3 @@ Run the code with your current TypeScript setup. If you're using `ts-node`, you npx ts-node index.ts ``` - - - - Install Prisma Client - - - - Evolve your schema - - - diff --git a/content/100-getting-started/02-setup-prisma/200-add-to-existing-project/110-relational-databases/250-querying-the-database-typescript-mysql.mdx b/content/100-getting-started/02-setup-prisma/200-add-to-existing-project/110-relational-databases/250-querying-the-database-typescript-mysql.mdx index 3d92093ffb..3ffa92e88b 100644 --- a/content/100-getting-started/02-setup-prisma/200-add-to-existing-project/110-relational-databases/250-querying-the-database-typescript-mysql.mdx +++ b/content/100-getting-started/02-setup-prisma/200-add-to-existing-project/110-relational-databases/250-querying-the-database-typescript-mysql.mdx @@ -27,7 +27,7 @@ For the purpose of this guide however, you'll just create a plain Node.js script Create a new file named `index.ts` and add the following code to it: -```ts file=index.ts +```ts file=index.ts showLineNumbers import { PrismaClient } from '@prisma/client' const prisma = new PrismaClient() @@ -61,7 +61,7 @@ The following examples are all based on the models in the Prisma schema. Inside the `main` function, add the following query to read all `User` records from the database and print the result: -```ts file=index.ts +```ts file=index.ts showLineNumbers async function main() { const allUsers = await prisma.user.findMany() console.log(allUsers) @@ -88,7 +88,7 @@ The `findMany` query you used in the previous section only _reads_ data from the Adjust the `main` function to send a `create` query to the database: -```ts file=index.ts +```ts file=index.ts showLineNumbers async function main() { await prisma.user.create({ data: { @@ -125,7 +125,7 @@ npx ts-node index.ts Before moving on to the next section, you'll "publish" the `Post` record you just created using an `update` query. Adjust the `main` function as follows: -```ts file=index.ts +```ts file=index.ts showLineNumbers async function main() { const post = await prisma.post.update({ where: { id: 1 }, @@ -140,25 +140,3 @@ Run the code with your current TypeScript setup. If you're using `ts-node`, you ```terminal copy npx ts-node index.ts ``` - - - - - Install Prisma Client - - - - Evolve your schema - - - diff --git a/content/100-getting-started/02-setup-prisma/200-add-to-existing-project/110-relational-databases/250-querying-the-database-typescript-planetscale.mdx b/content/100-getting-started/02-setup-prisma/200-add-to-existing-project/110-relational-databases/250-querying-the-database-typescript-planetscale.mdx index 4e76a5ed4e..4b827006fd 100644 --- a/content/100-getting-started/02-setup-prisma/200-add-to-existing-project/110-relational-databases/250-querying-the-database-typescript-planetscale.mdx +++ b/content/100-getting-started/02-setup-prisma/200-add-to-existing-project/110-relational-databases/250-querying-the-database-typescript-planetscale.mdx @@ -27,7 +27,7 @@ For the purpose of this guide however, you'll just create a plain Node.js script Create a new file named `index.ts` and add the following code to it: -```ts file=index.ts +```ts file=index.ts showLineNumbers import { PrismaClient } from '@prisma/client' const prisma = new PrismaClient() @@ -61,7 +61,7 @@ The following examples are all based on the models in the Prisma schema. Inside the `main` function, add the following query to read all `User` records from the database and print the result: -```ts file=index.ts +```ts file=index.ts showLineNumbers async function main() { const allUsers = await prisma.user.findMany() console.log(allUsers) @@ -89,7 +89,7 @@ The `findMany` query you used in the previous section only _reads_ data from the Adjust the `main` function to send a `create` query to the database: -```ts file=index.ts +```ts file=index.ts showLineNumbers async function main() { await prisma.user.create({ data: { @@ -126,7 +126,7 @@ npx ts-node index.ts Before moving on to the next section, you'll "publish" the `Post` record you just created using an `update` query. Adjust the `main` function as follows: -```ts file=index.ts +```ts file=index.ts showLineNumbers async function main() { const post = await prisma.post.update({ where: { id: 1 }, @@ -141,25 +141,3 @@ Run the code with your current TypeScript setup. If you're using `ts-node`, you ```terminal copy npx ts-node index.ts ``` - - - - - Install Prisma Client - - - - Next Steps - - - diff --git a/content/100-getting-started/02-setup-prisma/200-add-to-existing-project/110-relational-databases/250-querying-the-database-typescript-postgresql.mdx b/content/100-getting-started/02-setup-prisma/200-add-to-existing-project/110-relational-databases/250-querying-the-database-typescript-postgresql.mdx index 9ebe6e76ac..678dedb82a 100644 --- a/content/100-getting-started/02-setup-prisma/200-add-to-existing-project/110-relational-databases/250-querying-the-database-typescript-postgresql.mdx +++ b/content/100-getting-started/02-setup-prisma/200-add-to-existing-project/110-relational-databases/250-querying-the-database-typescript-postgresql.mdx @@ -26,7 +26,7 @@ For the purpose of this guide however, you'll just create a plain Node.js script Create a new file named `index.ts` and add the following code to it: -```ts file=index.ts +```ts file=index.ts showLineNumbers import { PrismaClient } from '@prisma/client' const prisma = new PrismaClient() @@ -60,7 +60,7 @@ The following examples are all based on the models in the Prisma schema. Inside the `main` function, add the following query to read all `User` records from the database and print the result: -```ts file=index.ts +```ts file=index.ts showLineNumbers async function main() { const allUsers = await prisma.user.findMany() console.log(allUsers) @@ -87,7 +87,7 @@ The `findMany` query you used in the previous section only _reads_ data from the Adjust the `main` function to send a `create` query to the database: -```ts file=index.ts +```ts file=index.ts showLineNumbers async function main() { await prisma.user.create({ data: { @@ -124,7 +124,7 @@ npx ts-node index.ts Before moving on to the next section, you'll "publish" the `Post` record you just created using an `update` query. Adjust the `main` function as follows: -```ts file=index.ts +```ts file=index.ts showLineNumbers async function main() { const post = await prisma.post.update({ where: { id: 1 }, @@ -139,25 +139,3 @@ Run the code with your current TypeScript setup. If you're using `ts-node`, you ```terminal copy npx ts-node index.ts ``` - - - - - Install Prisma Client - - - - Evolve your schema - - - diff --git a/content/100-getting-started/02-setup-prisma/200-add-to-existing-project/110-relational-databases/250-querying-the-database-typescript-sqlserver.mdx b/content/100-getting-started/02-setup-prisma/200-add-to-existing-project/110-relational-databases/250-querying-the-database-typescript-sqlserver.mdx index b2d511f105..fd3d714f91 100644 --- a/content/100-getting-started/02-setup-prisma/200-add-to-existing-project/110-relational-databases/250-querying-the-database-typescript-sqlserver.mdx +++ b/content/100-getting-started/02-setup-prisma/200-add-to-existing-project/110-relational-databases/250-querying-the-database-typescript-sqlserver.mdx @@ -27,7 +27,7 @@ For the purpose of this guide however, you'll just create a plain Node.js script Create a new file named `index.ts` and add the following code to it: -```ts file=index.ts +```ts file=index.ts showLineNumbers import { PrismaClient } from '@prisma/client' const prisma = new PrismaClient() @@ -61,7 +61,7 @@ The following examples are all based on the models in the Prisma schema. Inside the `main` function, add the following query to read all `User` records from the database and print the result: -```ts file=index.ts +```ts file=index.ts showLineNumbers async function main() { const allUsers = await prisma.user.findMany() console.log(allUsers) @@ -88,7 +88,7 @@ The `findMany` query you used in the previous section only _reads_ data from the Adjust the `main` function to send a `create` query to the database: -```ts file=index.ts +```ts file=index.ts showLineNumbers async function main() { await prisma.user.create({ data: { @@ -125,7 +125,7 @@ npx ts-node index.ts Before moving on to the next section, you'll "publish" the `Post` record you just created using an `update` query. Adjust the `main` function as follows: -```ts file=index.ts +```ts file=index.ts showLineNumbers async function main() { const post = await prisma.post.update({ where: { id: 1 }, @@ -140,25 +140,3 @@ Run the code with your current TypeScript setup. If you're using `ts-node`, you ```terminal copy npx ts-node index.ts ``` - - - - - Install Prisma Client - - - - Evolve your schema - - - diff --git a/content/100-getting-started/02-setup-prisma/200-add-to-existing-project/110-relational-databases/275-evolve-your-schema-node-cockroachdb.mdx b/content/100-getting-started/02-setup-prisma/200-add-to-existing-project/110-relational-databases/275-evolve-your-schema-node-cockroachdb.mdx index 63ffecec8b..679a8312cb 100644 --- a/content/100-getting-started/02-setup-prisma/200-add-to-existing-project/110-relational-databases/275-evolve-your-schema-node-cockroachdb.mdx +++ b/content/100-getting-started/02-setup-prisma/200-add-to-existing-project/110-relational-databases/275-evolve-your-schema-node-cockroachdb.mdx @@ -30,7 +30,7 @@ For the purpose of this guide, we'll make the following changes to the Prisma sc Once you've made the changes to your schema, your schema should resemble the one below: -```prisma file=prisma/schema.prisma highlight=9,27-31;edit +```prisma file=prisma/schema.prisma highlight=9,27-31;edit showLineNumbers model Post { id Int @id @default(autoincrement()) title String @db.VarChar(255) @@ -39,6 +39,7 @@ model Post { published Boolean @default(false) authorId Int user User @relation(fields: [authorId], references: [id]) + //edit-next-line tags Tag[] } @@ -57,11 +58,13 @@ model User { profile Profile? } +//edit-start model Tag { id Int @id @default(autoincrement()) name String posts Post[] } +//edit-end ``` To apply your Prisma schema changes to your database, use the `prisma migrate dev` CLI command: @@ -105,25 +108,3 @@ ALTER TABLE "_PostToTag" ADD CONSTRAINT "_PostToTag_A_fkey" FOREIGN KEY ("A") RE -- AddForeignKey ALTER TABLE "_PostToTag" ADD CONSTRAINT "_PostToTag_B_fkey" FOREIGN KEY ("B") REFERENCES "Tag"("id") ON DELETE CASCADE ON UPDATE CASCADE; ``` - - - - - Querying the database - - - - Next steps - - - diff --git a/content/100-getting-started/02-setup-prisma/200-add-to-existing-project/110-relational-databases/275-evolve-your-schema-node-mysql.mdx b/content/100-getting-started/02-setup-prisma/200-add-to-existing-project/110-relational-databases/275-evolve-your-schema-node-mysql.mdx index 50775eba3b..00b2d97ca6 100644 --- a/content/100-getting-started/02-setup-prisma/200-add-to-existing-project/110-relational-databases/275-evolve-your-schema-node-mysql.mdx +++ b/content/100-getting-started/02-setup-prisma/200-add-to-existing-project/110-relational-databases/275-evolve-your-schema-node-mysql.mdx @@ -30,7 +30,7 @@ For the purpose of this guide, we'll make the following changes to the Prisma sc Once you've made the changes to your schema, your schema should resemble the one below: -```prisma file=prisma/schema.prisma highlight=9,27-31;edit +```prisma file=prisma/schema.prisma highlight=9,27-31;edit showLineNumbers model Post { id Int @id @default(autoincrement()) title String @db.VarChar(255) @@ -39,6 +39,7 @@ model Post { published Boolean @default(false) authorId Int user User @relation(fields: [authorId], references: [id]) + //edit-next-line tags Tag[] } @@ -57,11 +58,13 @@ model User { profile Profile? } +//edit-start model Tag { id Int @id @default(autoincrement()) name String posts Post[] } +//edit-end ``` To apply your Prisma schema changes to your database, use the `prisma migrate dev` CLI command: @@ -107,20 +110,3 @@ ALTER TABLE _PostToTag ADD CONSTRAINT _PostToTag_B_fkey FOREIGN KEY (B) REFERENC ``` Congratulations, you just evolved your database with Prisma Migrate 🚀 - - - - - Querying the database - - - - Next steps - - - diff --git a/content/100-getting-started/02-setup-prisma/200-add-to-existing-project/110-relational-databases/275-evolve-your-schema-node-postgresql.mdx b/content/100-getting-started/02-setup-prisma/200-add-to-existing-project/110-relational-databases/275-evolve-your-schema-node-postgresql.mdx index 411a8df224..0efa8fe4f8 100644 --- a/content/100-getting-started/02-setup-prisma/200-add-to-existing-project/110-relational-databases/275-evolve-your-schema-node-postgresql.mdx +++ b/content/100-getting-started/02-setup-prisma/200-add-to-existing-project/110-relational-databases/275-evolve-your-schema-node-postgresql.mdx @@ -107,25 +107,3 @@ ALTER TABLE "_PostToTag" ADD CONSTRAINT "_PostToTag_B_fkey" FOREIGN KEY ("B") RE ``` Congratulations, you just evolved your database with Prisma Migrate 🚀 - - - - - Querying the database - - - - Next steps - - - diff --git a/content/100-getting-started/02-setup-prisma/200-add-to-existing-project/110-relational-databases/275-evolve-your-schema-node-sqlserver.mdx b/content/100-getting-started/02-setup-prisma/200-add-to-existing-project/110-relational-databases/275-evolve-your-schema-node-sqlserver.mdx index c5bd2dc5ff..86fcef8b84 100644 --- a/content/100-getting-started/02-setup-prisma/200-add-to-existing-project/110-relational-databases/275-evolve-your-schema-node-sqlserver.mdx +++ b/content/100-getting-started/02-setup-prisma/200-add-to-existing-project/110-relational-databases/275-evolve-your-schema-node-sqlserver.mdx @@ -30,7 +30,7 @@ For the purpose of this guide, we'll make the following changes to the Prisma sc Once you've made the changes to your schema, your schema should resemble the one below: -```prisma file=prisma/schema.prisma highlight=9,27-31;edit +```prisma file=prisma/schema.prisma highlight=9,27-31;edit showLineNumbers model Post { id Int @id @default(autoincrement()) title String @db.VarChar(255) @@ -39,6 +39,7 @@ model Post { published Boolean @default(false) authorId Int user User @relation(fields: [authorId], references: [id]) + //edit-next-line tags Tag[] } @@ -57,11 +58,13 @@ model User { profile Profile? } +//edit-start model Tag { id Int @id @default(autoincrement()) name String posts Post[] } +//edit-end ``` To apply your Prisma schema changes to your database, use the `prisma migrate dev` CLI command: @@ -107,25 +110,3 @@ ALTER TABLE [dbo].[_PostToTag] ADD CONSTRAINT [_PostToTag_B_fkey] FOREIGN KEY ([ ``` Congratulations - - - - - Querying the database - - - - Next steps - - - diff --git a/content/100-getting-started/02-setup-prisma/200-add-to-existing-project/110-relational-databases/275-evolve-your-schema-typescript-cockroachdb.mdx b/content/100-getting-started/02-setup-prisma/200-add-to-existing-project/110-relational-databases/275-evolve-your-schema-typescript-cockroachdb.mdx index 9456260cb6..4296a08275 100644 --- a/content/100-getting-started/02-setup-prisma/200-add-to-existing-project/110-relational-databases/275-evolve-your-schema-typescript-cockroachdb.mdx +++ b/content/100-getting-started/02-setup-prisma/200-add-to-existing-project/110-relational-databases/275-evolve-your-schema-typescript-cockroachdb.mdx @@ -30,7 +30,7 @@ For the purpose of this guide, we'll make the following changes to the Prisma sc Once you've made the changes to your schema, your schema should resemble the one below: -```prisma file=prisma/schema.prisma highlight=9,27-31;edit +```prisma file=prisma/schema.prisma highlight=9,27-31;edit showLineNumbers model Post { id Int @id @default(autoincrement()) title String @db.VarChar(255) @@ -39,6 +39,7 @@ model Post { published Boolean @default(false) authorId Int user User @relation(fields: [authorId], references: [id]) + //edit-next-line tags Tag[] } @@ -57,11 +58,13 @@ model User { profile Profile? } +//edit-start model Tag { id Int @id @default(autoincrement()) name String posts Post[] } +//edit-end ``` To apply your Prisma schema changes to your database, use the `prisma migrate dev` CLI command: @@ -108,24 +111,3 @@ ALTER TABLE "_PostToTag" ADD CONSTRAINT "_PostToTag_B_fkey" FOREIGN KEY ("B") RE Congratulations, you just evolved your database with Prisma Migrate 🚀 - - - - Querying the database - - - - Next steps - - - diff --git a/content/100-getting-started/02-setup-prisma/200-add-to-existing-project/110-relational-databases/275-evolve-your-schema-typescript-mysql.mdx b/content/100-getting-started/02-setup-prisma/200-add-to-existing-project/110-relational-databases/275-evolve-your-schema-typescript-mysql.mdx index 84a7e03ce7..00b2d97ca6 100644 --- a/content/100-getting-started/02-setup-prisma/200-add-to-existing-project/110-relational-databases/275-evolve-your-schema-typescript-mysql.mdx +++ b/content/100-getting-started/02-setup-prisma/200-add-to-existing-project/110-relational-databases/275-evolve-your-schema-typescript-mysql.mdx @@ -30,7 +30,7 @@ For the purpose of this guide, we'll make the following changes to the Prisma sc Once you've made the changes to your schema, your schema should resemble the one below: -```prisma file=prisma/schema.prisma highlight=9,27-31;edit +```prisma file=prisma/schema.prisma highlight=9,27-31;edit showLineNumbers model Post { id Int @id @default(autoincrement()) title String @db.VarChar(255) @@ -39,6 +39,7 @@ model Post { published Boolean @default(false) authorId Int user User @relation(fields: [authorId], references: [id]) + //edit-next-line tags Tag[] } @@ -57,11 +58,13 @@ model User { profile Profile? } +//edit-start model Tag { id Int @id @default(autoincrement()) name String posts Post[] } +//edit-end ``` To apply your Prisma schema changes to your database, use the `prisma migrate dev` CLI command: @@ -107,25 +110,3 @@ ALTER TABLE _PostToTag ADD CONSTRAINT _PostToTag_B_fkey FOREIGN KEY (B) REFERENC ``` Congratulations, you just evolved your database with Prisma Migrate 🚀 - - - - - Querying the database - - - - Next steps - - - diff --git a/content/100-getting-started/02-setup-prisma/200-add-to-existing-project/110-relational-databases/275-evolve-your-schema-typescript-postgresql.mdx b/content/100-getting-started/02-setup-prisma/200-add-to-existing-project/110-relational-databases/275-evolve-your-schema-typescript-postgresql.mdx index edf01530c3..6a95a6d23e 100644 --- a/content/100-getting-started/02-setup-prisma/200-add-to-existing-project/110-relational-databases/275-evolve-your-schema-typescript-postgresql.mdx +++ b/content/100-getting-started/02-setup-prisma/200-add-to-existing-project/110-relational-databases/275-evolve-your-schema-typescript-postgresql.mdx @@ -29,7 +29,7 @@ For the purpose of this guide, we'll make the following changes to the Prisma sc Once you've made the changes to your schema, your schema should resemble the one below: -```prisma file=prisma/schema.prisma highlight=9,27-31;edit +```prisma file=prisma/schema.prisma highlight=9,27-31;edit showLineNumbers model Post { id Int @id @default(autoincrement()) title String @db.VarChar(255) @@ -38,6 +38,7 @@ model Post { published Boolean @default(false) authorId Int user User @relation(fields: [authorId], references: [id]) + //edit-next-line tags Tag[] } @@ -56,11 +57,13 @@ model User { profile Profile? } +//edit-start model Tag { id Int @id @default(autoincrement()) name String posts Post[] } +//edit-end ``` To apply your Prisma schema changes to your database, use the `prisma migrate dev` CLI command: @@ -108,25 +111,3 @@ ALTER TABLE "_PostToTag" ADD CONSTRAINT "_PostToTag_B_fkey" FOREIGN KEY ("B") RE Congratulations, you just evolved your database with Prisma Migrate 🚀 - - - - - Querying the database - - - - Next steps - - - diff --git a/content/100-getting-started/02-setup-prisma/200-add-to-existing-project/110-relational-databases/275-evolve-your-schema-typescript-sqlserver.mdx b/content/100-getting-started/02-setup-prisma/200-add-to-existing-project/110-relational-databases/275-evolve-your-schema-typescript-sqlserver.mdx index 42840697d6..3d51bcafaf 100644 --- a/content/100-getting-started/02-setup-prisma/200-add-to-existing-project/110-relational-databases/275-evolve-your-schema-typescript-sqlserver.mdx +++ b/content/100-getting-started/02-setup-prisma/200-add-to-existing-project/110-relational-databases/275-evolve-your-schema-typescript-sqlserver.mdx @@ -30,7 +30,7 @@ For the purpose of this guide, we'll make the following changes to the Prisma sc Once you've made the changes to your schema, your schema should resemble the one below: -```prisma file=prisma/schema.prisma highlight=9,27-31;edit +```prisma file=prisma/schema.prisma highlight=9,27-31;edit showLineNumbers model Post { id Int @id @default(autoincrement()) title String @db.VarChar(255) @@ -39,6 +39,7 @@ model Post { published Boolean @default(false) authorId Int user User @relation(fields: [authorId], references: [id]) + //edit-next-line tags Tag[] } @@ -57,11 +58,13 @@ model User { profile Profile? } +//edit-start model Tag { id Int @id @default(autoincrement()) name String posts Post[] } +//edit-end ``` To apply your Prisma schema changes to your database, use the `prisma migrate dev` CLI command: @@ -78,7 +81,7 @@ This command will: The following migration will be generated and saved in your `prisma/migrations` folder: -```sql file=prisma/migrations/TIMESTAMP_tags_model.sql +```sql file=prisma/migrations/TIMESTAMP_tags_model.sql -- CreateTable CREATE TABLE [dbo].[Tag] ( [id] SERIAL NOT NULL, @@ -107,25 +110,3 @@ ALTER TABLE [dbo].[_PostToTag] ADD CONSTRAINT [_PostToTag_B_fkey] FOREIGN KEY ([ ``` Congratulations, you just evolved your database with Prisma Migrate 🚀 - - - - - Querying the database - - - - Next steps - - - diff --git a/content/100-getting-started/02-setup-prisma/200-add-to-existing-project/120-mongodb-node-mongodb.mdx b/content/100-getting-started/02-setup-prisma/200-add-to-existing-project/120-mongodb-node-mongodb.mdx index 9f5d41a541..16c076d967 100644 --- a/content/100-getting-started/02-setup-prisma/200-add-to-existing-project/120-mongodb-node-mongodb.mdx +++ b/content/100-getting-started/02-setup-prisma/200-add-to-existing-project/120-mongodb-node-mongodb.mdx @@ -73,16 +73,3 @@ This command does two things: - creates a new directory called `prisma` that contains a file called `schema.prisma`, which contains the Prisma schema with your database connection variable and schema models - creates the [`.env` file](/orm/more/development-environment/environment-variables/env-files) in the root directory of the project, which is used for defining environment variables (such as your database connection) - - - - - Connect your database - - - diff --git a/content/100-getting-started/02-setup-prisma/200-add-to-existing-project/120-mongodb-typescript-mongodb.mdx b/content/100-getting-started/02-setup-prisma/200-add-to-existing-project/120-mongodb-typescript-mongodb.mdx index f33980c619..9aef7d576f 100644 --- a/content/100-getting-started/02-setup-prisma/200-add-to-existing-project/120-mongodb-typescript-mongodb.mdx +++ b/content/100-getting-started/02-setup-prisma/200-add-to-existing-project/120-mongodb-typescript-mongodb.mdx @@ -74,16 +74,3 @@ This command does two things: - creates a new directory called `prisma` that contains a file called `schema.prisma`, which contains the Prisma schema with your database connection variable and schema models - creates the [`.env` file](/orm/more/development-environment/environment-variables/env-files) in the root directory of the project, which is used for defining environment variables (such as your database connection) - - - - - Connect your database - - - diff --git a/content/100-getting-started/02-setup-prisma/200-add-to-existing-project/120-mongodb/100-connect-your-database-node-mongodb.mdx b/content/100-getting-started/02-setup-prisma/200-add-to-existing-project/120-mongodb/100-connect-your-database-node-mongodb.mdx index 3e487ef8ad..f526779fe1 100644 --- a/content/100-getting-started/02-setup-prisma/200-add-to-existing-project/120-mongodb/100-connect-your-database-node-mongodb.mdx +++ b/content/100-getting-started/02-setup-prisma/200-add-to-existing-project/120-mongodb/100-connect-your-database-node-mongodb.mdx @@ -21,7 +21,7 @@ pagination_next: getting-started/setup-prisma/add-to-existing-project/mongodb/in To connect your database, you need to set the `url` field of the `datasource` block in your Prisma schema to your database [connection URL](/orm/reference/connection-urls): -```prisma file=prisma/schema.prisma +```prisma file=prisma/schema.prisma showLineNumbers datasource db { provider = "mongodb" url = env("DATABASE_URL") @@ -51,25 +51,3 @@ Here's a short explanation of each component: - `DATABASE`: The name of the database > If you see the following error: `Error in connector: SCRAM failure: Authentication failed.`, you can specify the source database for the authentication by [adding](https://github.com/prisma/prisma/discussions/9994#discussioncomment-1562283) `?authSource=admin` to the end of the connection string. - - - - - Installation - - - - Introspection - - - diff --git a/content/100-getting-started/02-setup-prisma/200-add-to-existing-project/120-mongodb/100-connect-your-database-typescript-mongodb.mdx b/content/100-getting-started/02-setup-prisma/200-add-to-existing-project/120-mongodb/100-connect-your-database-typescript-mongodb.mdx index 758425efe7..348771fc99 100644 --- a/content/100-getting-started/02-setup-prisma/200-add-to-existing-project/120-mongodb/100-connect-your-database-typescript-mongodb.mdx +++ b/content/100-getting-started/02-setup-prisma/200-add-to-existing-project/120-mongodb/100-connect-your-database-typescript-mongodb.mdx @@ -19,7 +19,7 @@ pagination_next: getting-started/setup-prisma/add-to-existing-project/mongodb/in To connect your database, you need to set the `url` field of the `datasource` block in your Prisma schema to your database [connection URL](/orm/reference/connection-urls): -```prisma file=prisma/schema.prisma +```prisma file=prisma/schema.prisma showLineNumbers datasource db { provider = "mongodb" url = env("DATABASE_URL") @@ -50,24 +50,3 @@ Here's a short explanation of each component: > If you see the following error: `Error in connector: SCRAM failure: Authentication failed.`, you can specify the source database for the authentication by [adding](https://github.com/prisma/prisma/discussions/9994#discussioncomment-1562283) `?authSource=admin` to the end of the connection string. - - - - Installation - - - - Introspection - - - diff --git a/content/100-getting-started/02-setup-prisma/200-add-to-existing-project/120-mongodb/125-introspection-node-mongodb.mdx b/content/100-getting-started/02-setup-prisma/200-add-to-existing-project/120-mongodb/125-introspection-node-mongodb.mdx index e29de21457..c0149ac14a 100644 --- a/content/100-getting-started/02-setup-prisma/200-add-to-existing-project/120-mongodb/125-introspection-node-mongodb.mdx +++ b/content/100-getting-started/02-setup-prisma/200-add-to-existing-project/120-mongodb/125-introspection-node-mongodb.mdx @@ -50,7 +50,7 @@ npx prisma init Initializing Prisma ORM will create a `prisma/schema.prisma` file. Edit this file to use MongoDB: -```prisma file=prisma/schema.prisma +```prisma file=prisma/schema.prisma showLineNumbers datasource db { provider = "mongodb" url = env("DATABASE_URL") @@ -73,7 +73,7 @@ npx prisma db pull This command introspects our database and writes the inferred schema into your `prisma/schema.prisma` file: -```prisma file=prisma/schema.prisma +```prisma file=prisma/schema.prisma showLineNumbers datasource db { provider = "mongodb" url = env("DATABASE_URL") @@ -99,7 +99,7 @@ model User { To be able to join data using Prisma Client, you can add the [`@relation`](/orm/reference/prisma-schema-reference#relation) attributes to our models: -```prisma file=prisma/schema.prisma highlight=14;add|20;add +```prisma file=prisma/schema.prisma highlight=14;add|20;add showLineNumbers datasource db { provider = "mongodb" url = env("DATABASE_URL") @@ -113,12 +113,14 @@ model Post { id String @id @default(auto()) @map("_id") @db.ObjectId title String userId String @db.ObjectId + //add-next-line user User @relation(fields: [userId], references: [id]) } model User { id String @id @default(auto()) @map("_id") @db.ObjectId email String + //add-next-line posts Post[] } ``` @@ -131,24 +133,3 @@ We're actively working on MongoDB introspection. Provide feedback for this featu And with that, you're ready to generate Prisma Client. - - - - Connect to your Database - - - - Install Prisma Client - - - diff --git a/content/100-getting-started/02-setup-prisma/200-add-to-existing-project/120-mongodb/125-introspection-typescript-mongodb.mdx b/content/100-getting-started/02-setup-prisma/200-add-to-existing-project/120-mongodb/125-introspection-typescript-mongodb.mdx index 4407f4439b..27932758cf 100644 --- a/content/100-getting-started/02-setup-prisma/200-add-to-existing-project/120-mongodb/125-introspection-typescript-mongodb.mdx +++ b/content/100-getting-started/02-setup-prisma/200-add-to-existing-project/120-mongodb/125-introspection-typescript-mongodb.mdx @@ -49,7 +49,7 @@ npx prisma init Initializing Prisma ORM will create a `prisma/schema.prisma` file. Edit this file to use MongoDB: -```prisma file=prisma/schema.prisma +```prisma file=prisma/schema.prisma showLineNumbers datasource db { provider = "mongodb" url = env("DATABASE_URL") @@ -72,7 +72,7 @@ npx prisma db pull This command introspects our database and writes the inferred schema into your `prisma/schema.prisma` file: -```prisma file=prisma/schema.prisma +```prisma file=prisma/schema.prisma showLineNumbers datasource db { provider = "mongodb" url = env("DATABASE_URL") @@ -98,7 +98,7 @@ model User { To be able to join data using Prisma Client, you can add the [`@relation`](/orm/reference/prisma-schema-reference#relation) attributes to our models: -```prisma file=prisma/schema.prisma highlight=14;add|20;add +```prisma file=prisma/schema.prisma highlight=14;add|20;add showLineNumbers datasource db { provider = "mongodb" url = env("DATABASE_URL") @@ -112,12 +112,14 @@ model Post { id String @id @default(auto()) @map("_id") @db.ObjectId title String userId String @db.ObjectId + //add-next-line user User @relation(fields: [userId], references: [id]) } model User { id String @id @default(auto()) @map("_id") @db.ObjectId email String + //add-next-line posts Post[] } ``` @@ -129,25 +131,3 @@ We're actively working on MongoDB introspection. Provide feedback for this featu ::: And with that, you're ready to generate Prisma Client. - - - - - Connect to your Database - - - - Install Prisma Client - - - diff --git a/content/100-getting-started/02-setup-prisma/200-add-to-existing-project/120-mongodb/200-install-prisma-client-node-mongodb.mdx b/content/100-getting-started/02-setup-prisma/200-add-to-existing-project/120-mongodb/200-install-prisma-client-node-mongodb.mdx index 03bbab4bee..01042e9488 100644 --- a/content/100-getting-started/02-setup-prisma/200-add-to-existing-project/120-mongodb/200-install-prisma-client-node-mongodb.mdx +++ b/content/100-getting-started/02-setup-prisma/200-add-to-existing-project/120-mongodb/200-install-prisma-client-node-mongodb.mdx @@ -30,25 +30,3 @@ The install command invokes `prisma generate` for you which reads your Prisma sc Whenever you make changes to your Prisma schema in the future, you manually need to invoke `prisma generate` in order to accommodate the changes in your Prisma Client API. - - - - - Introspection - - - - Querying the database - - - diff --git a/content/100-getting-started/02-setup-prisma/200-add-to-existing-project/120-mongodb/200-install-prisma-client-typescript-mongodb.mdx b/content/100-getting-started/02-setup-prisma/200-add-to-existing-project/120-mongodb/200-install-prisma-client-typescript-mongodb.mdx index 6c1e9c39c7..eb32fd3794 100644 --- a/content/100-getting-started/02-setup-prisma/200-add-to-existing-project/120-mongodb/200-install-prisma-client-typescript-mongodb.mdx +++ b/content/100-getting-started/02-setup-prisma/200-add-to-existing-project/120-mongodb/200-install-prisma-client-typescript-mongodb.mdx @@ -28,25 +28,3 @@ The install command invokes `prisma generate` for you which reads your Prisma sc ![Install and generate Prisma Client](/img/getting-started/prisma-client-install-and-generate.png) Whenever you make changes to your Prisma schema in the future, you manually need to invoke `prisma generate` in order to accommodate the changes in your Prisma Client API. - - - - - Introspection - - - - Querying the database - - - diff --git a/content/100-getting-started/02-setup-prisma/200-add-to-existing-project/120-mongodb/250-querying-the-database-node-mongodb.mdx b/content/100-getting-started/02-setup-prisma/200-add-to-existing-project/120-mongodb/250-querying-the-database-node-mongodb.mdx index ae69e13aa1..699284a996 100644 --- a/content/100-getting-started/02-setup-prisma/200-add-to-existing-project/120-mongodb/250-querying-the-database-node-mongodb.mdx +++ b/content/100-getting-started/02-setup-prisma/200-add-to-existing-project/120-mongodb/250-querying-the-database-node-mongodb.mdx @@ -220,19 +220,3 @@ You will see the following output: Fantastic, you just wrote new data into your database for the first time using Prisma Client 🚀 - - - - Install Prisma Client - - - - Next Steps - - - diff --git a/content/100-getting-started/02-setup-prisma/200-add-to-existing-project/120-mongodb/250-querying-the-database-typescript-mongodb.mdx b/content/100-getting-started/02-setup-prisma/200-add-to-existing-project/120-mongodb/250-querying-the-database-typescript-mongodb.mdx index 93c8adba26..7bb9ade094 100644 --- a/content/100-getting-started/02-setup-prisma/200-add-to-existing-project/120-mongodb/250-querying-the-database-typescript-mongodb.mdx +++ b/content/100-getting-started/02-setup-prisma/200-add-to-existing-project/120-mongodb/250-querying-the-database-typescript-mongodb.mdx @@ -56,7 +56,7 @@ Here's a quick overview of the different parts of the code snippet: Inside the `main` function, add the following query to read all `User` records from the database and print the result: -```ts file=index.ts +```ts file=index.ts showLineNumbers async function main() { // ... you will write your Prisma Client queries here + const allUsers = await prisma.user.findMany() @@ -78,7 +78,7 @@ The `findMany` query you used in the previous section only _reads_ data from the Adjust the `main` function to send a `create` query to the database: -```ts file=index.ts copy +```ts file=index.ts copy showLineNumbers async function main() { await prisma.user.create({ data: { @@ -136,7 +136,7 @@ The output should look similar to this: Also note that `allUsers` is _statically typed_ thanks to [Prisma Client's generated types](/orm/prisma-client/type-safety/operating-against-partial-structures-of-model-types). You can observe the type by hovering over the `allUsers` variable in your editor. It should be typed as follows: -```ts no-lines +```ts no-lines showLineNumbers const allUsers: (User & { posts: Post[] })[] @@ -174,7 +174,7 @@ The `id` field in the Prisma schema maps to `_id` in the underlying MongoDB data Before moving on to the next section, you'll add a couple of comments to the `Post` record you just created using an `update` query. Adjust the `main` function as follows: -```ts file=index.ts copy +```ts file=index.ts copy showLineNumbers async function main() { await prisma.post.update({ where: { @@ -234,25 +234,3 @@ You will see the following output: ``` Fantastic, you just wrote new data into your database for the first time using Prisma Client 🚀 - - - - - Install Prisma Client - - - - Next Steps - - - 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 bce26c7719..74c1a6db21 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 @@ -20,7 +20,7 @@ Prisma ORM is an [open-source](https://github.com/prisma/prisma) next-generation Prisma Client can be used in _any_ Node.js (supported versions) or TypeScript backend application (including serverless applications and microservices). This can be a [REST API](/orm/overview/prisma-in-your-stack/rest), a [GraphQL API](/orm/overview/prisma-in-your-stack/graphql), a gRPC API, or anything else that needs a database. -
+