diff --git a/content/100-getting-started/01-quickstart.mdx b/content/100-getting-started/01-quickstart.mdx index 79736b22b2..74ed41b245 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() { - // add-start + // highlight-start const user = await prisma.user.create({ data: { name: 'Alice', @@ -162,7 +162,7 @@ async function main() { }, }) console.log(user) - // add-end + // highlight-end } main() @@ -210,10 +210,10 @@ import { PrismaClient } from '@prisma/client' const prisma = new PrismaClient() async function main() { - // add-start + // highlight-start const users = await prisma.user.findMany() console.log(users) - // add-end + // highlight-end } main() @@ -263,7 +263,7 @@ import { PrismaClient } from '@prisma/client' const prisma = new PrismaClient() async function main() { - // add-start + // highlight-start const user = await prisma.user.create({ data: { name: 'Bob', @@ -276,7 +276,7 @@ async function main() { }, }) console.log(user) - // add-end + // highlight-end } main() @@ -322,14 +322,14 @@ import { PrismaClient } from '@prisma/client' const prisma = new PrismaClient() async function main() { -// add-start +// highlight-start const usersWithPosts = await prisma.user.findMany({ include: { posts: true, }, }) console.dir(usersWithPosts, { depth: null }) - // add-end + // highlight-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 e5c5303236..00bb760dcf 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,3 +50,15 @@ 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 c7eaab65d9..42077a32f9 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,3 +73,16 @@ 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 9df70e4bad..429646b354 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,3 +65,16 @@ 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 0af9b49876..6ed30008c2 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,3 +72,16 @@ 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 1238c5b813..7691502cd3 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,3 +75,16 @@ 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 684f7deda6..5185fcdc7c 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,3 +78,15 @@ 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 0b97c35a7b..f95248d983 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,3 +78,16 @@ 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 adc567a7ad..6fbc13c06f 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,3 +84,16 @@ 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 e6a296c5c4..7346a2d127 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,3 +77,16 @@ 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 80298bdd93..23584767a5 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,3 +80,16 @@ 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 9ef16be4d7..5b02b1e6e9 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 showLineNumbers +```prisma file=prisma/schema.prisma datasource db { provider = "postgresql" url = env("DATABASE_URL") @@ -69,3 +69,25 @@ 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 a1b84f6fe2..e504af145b 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 showLineNumbers +```prisma file=prisma/schema.prisma datasource db { provider = "postgresql" url = env("DATABASE_URL") @@ -76,3 +76,25 @@ 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 41a98ad7d2..28bf68dd47 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 showLineNumbers +```prisma file=prisma/schema.prisma 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") - //add-next-line + //highlight-next-line relationMode = "prisma" } ``` @@ -104,3 +104,26 @@ 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 b94ea69560..1817fc0d39 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 showLineNumbers +```prisma file=prisma/schema.prisma datasource db { provider = "postgresql" url = env("DATABASE_URL") @@ -69,4 +69,26 @@ 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" -``` \ No newline at end of file +``` + + + + + 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-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 694cb32284..bd38f626c7 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 showLineNumbers +```prisma file=prisma/schema.prisma datasource db { provider = "sqlserver" url = env("DATABASE_URL") @@ -45,3 +45,24 @@ 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 71fc1cec0b..7d56f86be7 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 showLineNumbers +```prisma file=prisma/schema.prisma datasource db { provider = "postgresql" url = env("DATABASE_URL") @@ -69,3 +69,25 @@ 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 9763de242b..6f830685f9 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 showLineNumbers +```prisma file=prisma/schema.prisma datasource db { provider = "postgresql" url = env("DATABASE_URL") @@ -76,3 +76,25 @@ 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 d2813c717a..485922e869 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 showLineNumbers +```prisma file=prisma/schema.prisma datasource db { provider = "postgresql" url = env("DATABASE_URL") @@ -30,9 +30,8 @@ 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 showLineNumbers +```prisma file=prisma/schema.prisma highlight=2;edit datasource db { - //edit-next-line provider = "mysql" url = env("DATABASE_URL") } @@ -40,11 +39,10 @@ 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 showLineNumbers +```prisma file=schema.prisma highlight=4;add datasource db { provider = "mysql" url = env("DATABASE_URL") - //add-next-line relationMode = "prisma" } ``` @@ -104,3 +102,25 @@ 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 b8f1ee888f..26062f3c99 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 showLineNumbers +```prisma file=prisma/schema.prisma datasource db { provider = "postgresql" url = env("DATABASE_URL") @@ -68,3 +68,25 @@ 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 bf7c6a589b..00bd27949f 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 showLineNumbers +```prisma file=prisma/schema.prisma datasource db { provider = "sqlserver" url = env("DATABASE_URL") @@ -45,3 +45,25 @@ 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 d1b1da1182..210495980c 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 showLineNumbers +```prisma file=prisma/schema.prisma copy model Post { id BigInt @id @default(sequence()) createdAt DateTime @default(now()) @@ -64,3 +64,25 @@ 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 aaf8a67e76..484baf1878 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 showLineNumbers +```prisma file=prisma/schema.prisma copy model Post { id Int @id @default(autoincrement()) createdAt DateTime @default(now()) @@ -63,3 +63,25 @@ 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 e360769618..b6e490d7d4 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 showLineNumbers +```prisma file=prisma/schema.prisma copy model Post { id Int @id @default(autoincrement()) createdAt DateTime @default(now()) @@ -61,3 +61,25 @@ 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 fa19622a5d..d31a36bcc3 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 showLineNumbers +```prisma file=prisma/schema.prisma model Post { id Int @id @default(autoincrement()) createdAt DateTime @default(now()) @@ -64,3 +64,25 @@ 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 38ebccb4be..79231ef6b6 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 showLineNumbers +```prisma file=prisma/schema.prisma copy model Post { id Int @id @default(autoincrement()) createdAt DateTime @default(now()) @@ -62,3 +62,25 @@ 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 07106fc469..167f0cc667 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 showLineNumbers +```prisma file=prisma/schema.prisma copy model Post { id BigInt @id @default(sequence()) createdAt DateTime @default(now()) @@ -64,3 +64,25 @@ 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 7ccbda5ebf..f35a855f8f 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 showLineNumbers +```prisma file=prisma/schema.prisma copy model Post { id Int @id @default(autoincrement()) createdAt DateTime @default(now()) @@ -62,3 +62,25 @@ 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 937ab9f84b..5d7346fbb4 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 showLineNumbers +```prisma file=prisma/schema.prisma copy model Post { id Int @id @default(autoincrement()) createdAt DateTime @default(now()) @@ -61,3 +61,25 @@ 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 bbf2012726..1cbca4807a 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 showLineNumbers +```prisma file=prisma/schema.prisma model Post { id Int @id @default(autoincrement()) createdAt DateTime @default(now()) @@ -63,3 +63,25 @@ 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 24b3a62f89..54d0279ca9 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 showLineNumbers +```prisma file=prisma/schema.prisma copy model Post { id Int @id @default(autoincrement()) createdAt DateTime @default(now()) @@ -62,3 +62,25 @@ 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 569e44d131..2e965b2a51 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,3 +29,25 @@ 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 be1955d45c..42136dbfba 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,3 +30,24 @@ 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 73cc171ca9..850420a9b0 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,3 +30,25 @@ 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 8d6920284a..8b26685183 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,3 +30,25 @@ 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 0785440c62..e6b348edcb 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,3 +30,25 @@ 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 f606da4a8b..01295f010c 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,3 +30,25 @@ 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 6865105554..1c606f2648 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,3 +31,24 @@ 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 48b7b875fd..ac1d8b9847 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,3 +30,25 @@ 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 0fc9c187ba..b3022b9a7d 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,3 +29,25 @@ 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 00f38caeca..4330e3a897 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,3 +30,25 @@ 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 02bdd431a9..e4f21a86f8 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 showLineNumbers +```js file=index.js copy const { PrismaClient } = require('@prisma/client') const prisma = new PrismaClient() @@ -52,14 +52,11 @@ 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 showLineNumbers +```js file=index.js highlight=2;delete|3,4;add 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 } ``` @@ -81,9 +78,8 @@ 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 showLineNumbers +```js file=index.js highlight=2-21;add copy async function main() { - //add-start await prisma.user.create({ data: { name: 'Alice', @@ -104,7 +100,6 @@ async function main() { }, }) console.dir(allUsers, { depth: null }) - //add-end } ``` @@ -207,3 +202,25 @@ 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 5f44d6e771..a699ad138d 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 showLineNumbers +```js file=index.js copy 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 - //add-start + //highlight-start const allUsers = await prisma.user.findMany() console.log(allUsers) - //add-end + //highlight-end } ``` @@ -81,9 +81,8 @@ 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 showLineNumbers +```js file=index.js highlight=2-21;add copy async function main() { - //add-start await prisma.user.create({ data: { name: 'Alice', @@ -104,7 +103,6 @@ async function main() { }, }) console.dir(allUsers, { depth: null }) - //add-end } ``` @@ -207,3 +205,20 @@ 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 11b53496c6..35229b1b0a 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 showLineNumbers +```js file=index.js copy const { PrismaClient } = require('@prisma/client') const prisma = new PrismaClient() @@ -52,14 +52,11 @@ 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 showLineNumbers +```js file=index.js highlight=2;delete|3,4;add 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 } ``` @@ -81,9 +78,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 showLineNumbers +```js file=index.js highlight=2-21;add copy async function main() { - //add-start + //highlight-start await prisma.user.create({ data: { name: 'Alice', @@ -104,7 +101,7 @@ async function main() { }, }) console.dir(allUsers, { depth: null }) - //add-end + //highlight-end } ``` @@ -208,3 +205,25 @@ 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 c8ba0068a7..4d35eec13e 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 showLineNumbers +```js file=index.js copy const { PrismaClient } = require('@prisma/client') const prisma = new PrismaClient() @@ -53,14 +53,11 @@ 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 showLineNumbers +```js file=index.js highlight=2;delete|3,4;add 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 } ``` @@ -82,9 +79,8 @@ 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 showLineNumbers +```js file=index.js highlight=2-21;add copy async function main() { - //add-start await prisma.user.create({ data: { name: 'Alice', @@ -105,7 +101,6 @@ async function main() { }, }) console.dir(allUsers, { depth: null }) - //add-end } ``` @@ -208,3 +203,25 @@ 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 5cbb1829c9..7ab1e17666 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 showLineNumbers +```js file=index.js copy const { PrismaClient } = require('@prisma/client') const prisma = new PrismaClient() @@ -52,14 +52,11 @@ 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 showLineNumbers +```js file=index.js highlight=2;delete|3,4;add 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 } ``` @@ -81,9 +78,8 @@ 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 showLineNumbers +```js file=index.js highlight=2-21;add copy async function main() { - //add-start await prisma.user.create({ data: { name: 'Alice', @@ -104,7 +100,6 @@ async function main() { }, }) console.dir(allUsers, { depth: null }) - //add-end } ``` @@ -207,3 +202,25 @@ 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 4962bda8bd..bee5d29fd2 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 showLineNumbers +```js file=index.ts copy import { PrismaClient } from '@prisma/client' const prisma = new PrismaClient() @@ -52,13 +52,11 @@ 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 showLineNumbers +```ts file=index.ts highlight=3,4;add async function main() { // ... you will write your Prisma Client queries here - //add-start const allUsers = await prisma.user.findMany() console.log(allUsers) - //add-end } ``` @@ -80,9 +78,8 @@ 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 showLineNumbers +```ts file=index.ts highlight=2-21;add copy async function main() { - //add-start await prisma.user.create({ data: { name: 'Alice', @@ -103,7 +100,6 @@ async function main() { }, }) console.dir(allUsers, { depth: null }) - //add-end } ``` @@ -185,7 +181,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 showLineNumbers +```ts file=index.ts copy async function main() { const post = await prisma.post.update({ where: { id: 1 }, @@ -222,3 +218,48 @@ 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 4962bda8bd..66c53f89cb 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 showLineNumbers +```js file=index.ts copy import { PrismaClient } from '@prisma/client' const prisma = new PrismaClient() @@ -52,13 +52,11 @@ 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 showLineNumbers +```ts file=index.ts highlight=3,4;add async function main() { // ... you will write your Prisma Client queries here - //add-start const allUsers = await prisma.user.findMany() console.log(allUsers) - //add-end } ``` @@ -80,9 +78,8 @@ 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 showLineNumbers +```ts file=index.ts highlight=2-21;add copy async function main() { - //add-start await prisma.user.create({ data: { name: 'Alice', @@ -103,7 +100,6 @@ async function main() { }, }) console.dir(allUsers, { depth: null }) - //add-end } ``` @@ -185,7 +181,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 showLineNumbers +```ts file=index.ts copy async function main() { const post = await prisma.post.update({ where: { id: 1 }, @@ -222,3 +218,25 @@ 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 91db459fb9..f96f4360f4 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 showLineNumbers +```js file=index.ts copy import { PrismaClient } from '@prisma/client' const prisma = new PrismaClient() @@ -52,13 +52,11 @@ 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 showLineNumbers +```ts file=index.ts highlight=3,4;add async function main() { // ... you will write your Prisma Client queries here - //add-start const allUsers = await prisma.user.findMany() console.log(allUsers) - //add-end } ``` @@ -80,9 +78,8 @@ 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 showLineNumbers +```ts file=index.ts highlight=2-21;add copy async function main() { - //add-start await prisma.user.create({ data: { name: 'Alice', @@ -103,7 +100,6 @@ async function main() { }, }) console.dir(allUsers, { depth: null }) - //add-end } ``` @@ -185,7 +181,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 showLineNumbers +```ts file=index.ts copy async function main() { const post = await prisma.post.update({ where: { id: 1 }, @@ -223,3 +219,47 @@ 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 611acc2b9f..4c9323f97e 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 showLineNumbers +```js file=index.ts copy import { PrismaClient } from '@prisma/client' const prisma = new PrismaClient() @@ -51,13 +51,11 @@ 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 showLineNumbers +```ts file=index.ts highlight=3,4;add async function main() { // ... you will write your Prisma Client queries here - //add-start const allUsers = await prisma.user.findMany() console.log(allUsers) - //add-end } ``` @@ -79,9 +77,8 @@ 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 showLineNumbers +```ts file=index.ts highlight=2-21;add copy async function main() { - //add-start await prisma.user.create({ data: { name: 'Alice', @@ -102,7 +99,6 @@ async function main() { }, }) console.dir(allUsers, { depth: null }) - //add-end } ``` @@ -184,7 +180,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 showLineNumbers +```ts file=index.ts copy async function main() { const post = await prisma.post.update({ where: { id: 1 }, @@ -221,3 +217,25 @@ 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 d555d63552..71b516a0c0 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 showLineNumbers +```js file=index.ts copy import { PrismaClient } from '@prisma/client' const prisma = new PrismaClient() @@ -52,13 +52,11 @@ 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 showLineNumbers +```ts file=index.ts highlight=3,4;add async function main() { // ... you will write your Prisma Client queries here - //add-start const allUsers = await prisma.user.findMany() console.log(allUsers) - //add-end } ``` @@ -80,9 +78,8 @@ 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 showLineNumbers +```ts file=index.ts highlight=2-21;add copy async function main() { - //add-start await prisma.user.create({ data: { name: 'Alice', @@ -103,7 +100,6 @@ async function main() { }, }) console.dir(allUsers, { depth: null }) - //add-end } ``` @@ -185,7 +181,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 showLineNumbers +```ts file=index.ts copy async function main() { const post = await prisma.post.update({ where: { id: 1 }, @@ -224,3 +220,46 @@ 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 c449204456..6d8c291307 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,3 +72,16 @@ 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 c5d24af3d7..24d7077696 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,3 +77,16 @@ 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 98f4df0438..9c2268a7b8 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 showLineNumbers +```prisma file=prisma/schema.prisma datasource db { provider = "mongodb" url = env("DATABASE_URL") @@ -49,3 +49,25 @@ 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 53233ae2b9..b9af15f1ac 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 showLineNumbers +```prisma file=prisma/schema.prisma datasource db { provider = "mongodb" url = env("DATABASE_URL") @@ -47,3 +47,25 @@ 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 3b4b9b0c6d..43b36a19fd 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 showLineNumbers +```prisma file=prisma/schema.prisma datasource db { provider = "mongodb" url = env("DATABASE_URL") @@ -70,3 +70,25 @@ 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 4a8e7fa41d..c05a7759f9 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 showLineNumbers +```prisma file=prisma/schema.prisma datasource db { provider = "mongodb" url = env("DATABASE_URL") @@ -69,3 +69,24 @@ 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 64712a04ee..06a77e1f6c 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,3 +29,25 @@ 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 d755165a72..666b47630b 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,3 +28,25 @@ 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 d4d16b4df3..3e3acf1775 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 showLineNumbers +```js file=index.js copy const { PrismaClient } = require('@prisma/client') const prisma = new PrismaClient() @@ -55,12 +55,9 @@ 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 } ``` @@ -82,9 +79,8 @@ 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 showLineNumbers +```js file=index.js highlight=2-21;add copy async function main() { - //add-start await prisma.user.create({ data: { name: 'Rich', @@ -105,7 +101,6 @@ async function main() { }, }) console.dir(allUsers, { depth: null }) - //add-end } ``` @@ -159,7 +154,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 showLineNumbers +```js file=index.js copy async function main() { await prisma.post.update({ where: { @@ -219,3 +214,20 @@ 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 5ccb308ffc..d0e73e19cb 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 showLineNumbers +```js file=index.ts copy import { PrismaClient } from '@prisma/client' const prisma = new PrismaClient() @@ -51,16 +51,15 @@ 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 showLineNumbers +```ts file=index.ts 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 @@ -79,9 +78,8 @@ 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 showLineNumbers +```ts file=index.ts highlight=2-21;add copy async function main() { - //add-start await prisma.user.create({ data: { name: 'Rich', @@ -102,7 +100,6 @@ async function main() { }, }) console.dir(allUsers, { depth: null }) - //add-end } ``` @@ -172,7 +169,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 showLineNumbers +```ts file=index.ts copy async function main() { await prisma.post.update({ where: { @@ -232,3 +229,25 @@ 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 3e4b389631..233c76c3f6 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,3 +75,16 @@ 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 d6f89f9585..60c4aa99b4 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,3 +76,16 @@ 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 fdf2981664..03e2436057 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,3 +74,16 @@ 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 df24231dac..f8c4cc888f 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,3 +76,15 @@ 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 49936ac223..42895ca978 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,3 +69,16 @@ 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 e04c347c20..4282c7b1f8 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,3 +75,17 @@ 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 1372a0ae99..b69ff27df1 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,3 +74,16 @@ 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 bc4df8e87d..1a27f0b2c8 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,3 +74,16 @@ 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 8262062e74..31d0d05fe0 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,3 +71,16 @@ 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 7e26b4c46c..dc2a3e7d5f 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,3 +75,16 @@ 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 2c3c6dadd8..f2ed2a2b73 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 showLineNumbers +```prisma file=prisma/schema.prisma datasource db { provider = "postgresql" url = env("DATABASE_URL") @@ -31,9 +31,8 @@ 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 showLineNumbers +```prisma file=prisma/schema.prisma highlight=2;edit datasource db { - //edit-next-line provider = "cockroachdb" url = env("DATABASE_URL") } @@ -73,3 +72,24 @@ 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 759249a0a6..380a7aa73c 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 showLineNumbers +```prisma file=prisma/schema.prisma datasource db { provider = "postgresql" url = env("DATABASE_URL") @@ -30,9 +30,8 @@ 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 showLineNumbers +```prisma file=prisma/schema.prisma highlight=2;edit datasource db { - //edit-next-line provider = "mysql" url = env("DATABASE_URL") } @@ -73,3 +72,19 @@ 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 9597067c06..bf31328bd8 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 showLineNumbers +```prisma file=prisma/schema.prisma datasource db { provider = "postgresql" url = env("DATABASE_URL") @@ -30,9 +30,8 @@ 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 showLineNumbers +```prisma file=prisma/schema.prisma highlight=2;edit datasource db { - //edit-next-line provider = "mysql" url = env("DATABASE_URL") } @@ -40,11 +39,10 @@ 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 showLineNumbers +```prisma file=schema.prisma highlight=4;add datasource db { provider = "mysql" url = env("DATABASE_URL") - //add-next-line relationMode = "prisma" } ``` @@ -99,3 +97,24 @@ 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 54eef0eda3..ebeaf9a662 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 showLineNumbers +```prisma file=prisma/schema.prisma datasource db { provider = "postgresql" url = env("DATABASE_URL") @@ -59,3 +59,25 @@ 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 4e4b7ada2b..c485325a56 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 showLineNumbers +```prisma file=prisma/schema.prisma datasource db { provider = "sqlserver" url = env("DATABASE_URL") @@ -38,3 +38,24 @@ 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 61888658e6..2b59c9683d 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 showLineNumbers +```prisma file=prisma/schema.prisma datasource db { provider = "postgresql" url = env("DATABASE_URL") @@ -30,9 +30,8 @@ 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 showLineNumbers +```prisma file=prisma/schema.prisma highlight=2;edit datasource db { - //edit-next-line provider = "cockroachdb" url = env("DATABASE_URL") } @@ -71,3 +70,25 @@ 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 9078c46b8c..ab0ad0b1ac 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 showLineNumbers +```prisma file=prisma/schema.prisma datasource db { provider = "postgresql" url = env("DATABASE_URL") @@ -30,9 +30,8 @@ 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 showLineNumbers +```prisma file=prisma/schema.prisma highlight=2;edit datasource db { - //edit-next-line provider = "mysql" url = env("DATABASE_URL") } @@ -73,3 +72,25 @@ 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 eb2ff05a1c..e4bac40306 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 showLineNumbers +```prisma file=prisma/schema.prisma datasource db { provider = "postgresql" url = env("DATABASE_URL") @@ -30,9 +30,8 @@ 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 showLineNumbers +```prisma file=prisma/schema.prisma highlight=2;edit datasource db { - //edit-next-line provider = "mysql" url = env("DATABASE_URL") } @@ -40,11 +39,10 @@ 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 showLineNumbers +```prisma file=schema.prisma highlight=4;add datasource db { provider = "mysql" url = env("DATABASE_URL") - //add-next-line relationMode = "prisma" } ``` @@ -98,3 +96,25 @@ 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 e2d2be1c2d..2d45ba1ee3 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 showLineNumbers +```prisma file=prisma/schema.prisma datasource db { provider = "postgresql" url = env("DATABASE_URL") @@ -58,3 +58,25 @@ 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 8ca29dfcf9..c727af30d6 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 showLineNumbers +```prisma file=prisma/schema.prisma datasource db { provider = "sqlserver" url = env("DATABASE_URL") @@ -38,3 +38,25 @@ 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 b7b9c447d9..2a493957a1 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 showLineNumbers +```prisma file=prisma/schema.prisma 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 showLineNumbers +```prisma file=prisma/schema.prisma highlight=8,15,22,23;edit model Post { id BigInt @id @default(autoincrement()) title String @unique @db.String(255) @@ -144,7 +144,6 @@ model Post { content String? published Boolean @default(false) authorId BigInt - //edit-next-line author User @relation(fields: [authorId], references: [id], onDelete: NoAction, onUpdate: NoAction) } @@ -152,7 +151,6 @@ 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) } @@ -160,10 +158,8 @@ 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 } ``` @@ -222,3 +218,24 @@ 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 70315959b0..a68db39c3f 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 showLineNumbers +```prisma file=prisma/schema.prisma 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 showLineNumbers +```prisma file=prisma/schema.prisma highlight=8,17,24,25;edit model Post { id Int @id @default(autoincrement()) title String @db.VarChar(255) @@ -149,7 +149,6 @@ 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") @@ -159,7 +158,6 @@ 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") } @@ -167,10 +165,8 @@ 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 } ``` @@ -223,3 +219,25 @@ 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 96821fd322..c71d29d2b8 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 showLineNumbers +```prisma file=prisma/schema.prisma 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 showLineNumbers +```prisma file=prisma/schema.prisma highlight=8,17,27,28;add model Post { id Int @id @default(autoincrement()) createdAt DateTime @default(now()) @@ -147,7 +147,6 @@ 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 @@ -157,7 +156,6 @@ model Post { model Profile { id Int @id @default(autoincrement()) bio String? - //add-next-line user User @relation(fields: [userId], references: [id]) userId Int @unique @@ -168,10 +166,8 @@ model User { id Int @id @default(autoincrement()) email String @unique name String? - //add-start posts Post[] profile Profile? - //add-end } ``` @@ -239,3 +235,25 @@ 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 f41225d3fb..edbc355727 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 showLineNumbers +```prisma file=prisma/schema.prisma 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 showLineNumbers +```prisma file=prisma/schema.prisma highlight=8,15,22,23;edit model Post { id Int @id @default(autoincrement()) title String @db.VarChar(255) @@ -143,7 +143,6 @@ model Post { content String? published Boolean @default(false) authorId Int - //edit-next-line author User @relation(fields: [authorId], references: [id], onDelete: NoAction, onUpdate: NoAction) } @@ -151,7 +150,6 @@ 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) } @@ -159,10 +157,8 @@ 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 } ``` @@ -220,3 +216,25 @@ 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 6ef75594c7..2700562b1b 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 showLineNumbers +```prisma file=prisma/schema.prisma model Post { id Int @id @default(autoincrement()) title String @db.VarChar(255) @@ -142,14 +142,13 @@ 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 showLineNumbers +```prisma file=prisma/schema.prisma highlight=7,14,22,23;edit 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 } @@ -157,7 +156,6 @@ model Post { model Profile { id Int @id @default(autoincrement()) bio String? - //edit-next-line user User @relation(fields: [userId], references: [id]) userId Int @unique } @@ -166,10 +164,8 @@ 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 } ``` @@ -227,3 +223,25 @@ 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 7827c8c6a9..d3ecb6b2a7 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 showLineNumbers +```prisma file=prisma/schema.prisma 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 showLineNumbers +```prisma file=prisma/schema.prisma highlight=8,15,22,23;edit model Post { id BigInt @id @default(autoincrement()) title String @unique @db.String(255) @@ -143,7 +143,6 @@ 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,7 +150,6 @@ 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) } @@ -159,10 +157,8 @@ 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 } ``` @@ -220,3 +216,25 @@ 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 209275468f..138c1a963b 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 showLineNumbers +```prisma file=prisma/schema.prisma 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 showLineNumbers +```prisma file=prisma/schema.prisma highlight=8,17,24,25;edit model Post { id Int @id @default(autoincrement()) title String @db.VarChar(255) @@ -149,7 +149,6 @@ 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") @@ -159,7 +158,6 @@ 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") } @@ -167,10 +165,8 @@ 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 } ``` @@ -223,3 +219,25 @@ 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 ce7917ff4e..4fa3fccad1 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 showLineNumbers +```prisma file=prisma/schema.prisma 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 showLineNumbers +```prisma file=prisma/schema.prisma highlight=8,17,27,28;add model Post { id Int @id @default(autoincrement()) createdAt DateTime @default(now()) @@ -147,7 +147,6 @@ 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 @@ -157,7 +156,6 @@ model Post { model Profile { id Int @id @default(autoincrement()) bio String? - //add-next-line user User @relation(fields: [userId], references: [id]) userId Int @unique @@ -168,10 +166,8 @@ model User { id Int @id @default(autoincrement()) email String @unique name String? - //add-start posts Post[] profile Profile? - //add-end } ``` @@ -239,3 +235,25 @@ 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 fa88cadfdc..1f1330c7d4 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 showLineNumbers +```prisma file=prisma/schema.prisma 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 showLineNumbers +```prisma file=prisma/schema.prisma highlight=8,15,22,23;edit model Post { id Int @id @default(autoincrement()) title String @db.VarChar(255) @@ -142,7 +142,6 @@ 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,7 +149,6 @@ 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) } @@ -158,10 +156,8 @@ 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 } ``` @@ -219,3 +215,25 @@ 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 e4a3cb008d..f2d7978b17 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 showLineNumbers +```prisma file=prisma/schema.prisma model Post { id Int @id @default(autoincrement()) title String @db.VarChar(255) @@ -142,14 +142,13 @@ 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 showLineNumbers +```prisma file=prisma/schema.prisma highlight=7,14,22,23;edit 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 } @@ -157,7 +156,6 @@ model Post { model Profile { id Int @id @default(autoincrement()) bio String? - //edit-next-line user User @relation(fields: [userId], references: [id]) userId Int @unique } @@ -166,10 +164,8 @@ 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 } ``` @@ -227,3 +223,25 @@ 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 469b434da2..cd6b3abcec 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,3 +87,25 @@ 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 c77a86da0e..78cf5af3c7 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,3 +103,25 @@ 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 d3896f99e6..b877ec6014 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,3 +106,25 @@ 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 9c420fb013..1880d78e90 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,3 +95,25 @@ 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 fe1ffc329a..a7f3054a50 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,3 +76,25 @@ 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 f85a99dc6e..9596922f89 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,3 +104,25 @@ 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 30ebd5b36e..cc34251443 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,3 +105,25 @@ 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 10a1ad3b95..a0dd6ff651 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,3 +95,25 @@ 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 5278a26d08..82c24ee31b 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,3 +39,25 @@ 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 bb26346072..68ccc7d952 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,3 +39,25 @@ 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 f4373e2e7d..121ee41c17 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,3 +39,25 @@ 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 66c63dc180..d5aa0734be 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,3 +39,25 @@ 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 a7a2c199af..823cbc6445 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,3 +39,25 @@ 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 dd042bd4be..f32edf80ce 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,3 +39,25 @@ 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 750bce1e10..d2fb1c3205 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,3 +39,25 @@ 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 784cc64398..c24085b441 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,3 +39,25 @@ 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 6a69d01eb2..67291084cc 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,3 +38,25 @@ 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 26f3ace659..cfe36d32d6 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,3 +39,25 @@ 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 b4359c92a6..ee304dfffc 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,3 +125,25 @@ 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 fd188aaeb3..347acc1e1b 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,3 +127,25 @@ 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 7fc2523431..c404c19dc9 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,3 +139,24 @@ 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 b66725fe9e..4188a3ec2b 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,3 +126,25 @@ 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 dd75e69f68..6f0d0783b1 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,3 +134,25 @@ 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 41f7d44449..314b54596b 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 showLineNumbers +```ts file=index.ts 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 showLineNumbers +```ts file=index.ts 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 showLineNumbers +```ts file=index.ts 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 showLineNumbers +```ts file=index.ts async function main() { const post = await prisma.post.update({ where: { title: 'Hello World' }, @@ -141,3 +141,24 @@ 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 3ffa92e88b..3d92093ffb 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 showLineNumbers +```ts file=index.ts 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 showLineNumbers +```ts file=index.ts 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 showLineNumbers +```ts file=index.ts 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 showLineNumbers +```ts file=index.ts async function main() { const post = await prisma.post.update({ where: { id: 1 }, @@ -140,3 +140,25 @@ 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 4b827006fd..4e76a5ed4e 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 showLineNumbers +```ts file=index.ts 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 showLineNumbers +```ts file=index.ts 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 showLineNumbers +```ts file=index.ts 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 showLineNumbers +```ts file=index.ts async function main() { const post = await prisma.post.update({ where: { id: 1 }, @@ -141,3 +141,25 @@ 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 678dedb82a..9ebe6e76ac 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 showLineNumbers +```ts file=index.ts 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 showLineNumbers +```ts file=index.ts 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 showLineNumbers +```ts file=index.ts 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 showLineNumbers +```ts file=index.ts async function main() { const post = await prisma.post.update({ where: { id: 1 }, @@ -139,3 +139,25 @@ 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 fd3d714f91..b2d511f105 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 showLineNumbers +```ts file=index.ts 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 showLineNumbers +```ts file=index.ts 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 showLineNumbers +```ts file=index.ts 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 showLineNumbers +```ts file=index.ts async function main() { const post = await prisma.post.update({ where: { id: 1 }, @@ -140,3 +140,25 @@ 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 679a8312cb..63ffecec8b 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 showLineNumbers +```prisma file=prisma/schema.prisma highlight=9,27-31;edit model Post { id Int @id @default(autoincrement()) title String @db.VarChar(255) @@ -39,7 +39,6 @@ model Post { published Boolean @default(false) authorId Int user User @relation(fields: [authorId], references: [id]) - //edit-next-line tags Tag[] } @@ -58,13 +57,11 @@ 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,3 +105,25 @@ 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 00b2d97ca6..50775eba3b 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 showLineNumbers +```prisma file=prisma/schema.prisma highlight=9,27-31;edit model Post { id Int @id @default(autoincrement()) title String @db.VarChar(255) @@ -39,7 +39,6 @@ model Post { published Boolean @default(false) authorId Int user User @relation(fields: [authorId], references: [id]) - //edit-next-line tags Tag[] } @@ -58,13 +57,11 @@ 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: @@ -110,3 +107,20 @@ 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 0efa8fe4f8..411a8df224 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,3 +107,25 @@ 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 86fcef8b84..c5bd2dc5ff 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 showLineNumbers +```prisma file=prisma/schema.prisma highlight=9,27-31;edit model Post { id Int @id @default(autoincrement()) title String @db.VarChar(255) @@ -39,7 +39,6 @@ model Post { published Boolean @default(false) authorId Int user User @relation(fields: [authorId], references: [id]) - //edit-next-line tags Tag[] } @@ -58,13 +57,11 @@ 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: @@ -110,3 +107,25 @@ 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 4296a08275..9456260cb6 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 showLineNumbers +```prisma file=prisma/schema.prisma highlight=9,27-31;edit model Post { id Int @id @default(autoincrement()) title String @db.VarChar(255) @@ -39,7 +39,6 @@ model Post { published Boolean @default(false) authorId Int user User @relation(fields: [authorId], references: [id]) - //edit-next-line tags Tag[] } @@ -58,13 +57,11 @@ 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: @@ -111,3 +108,24 @@ 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 00b2d97ca6..84a7e03ce7 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 showLineNumbers +```prisma file=prisma/schema.prisma highlight=9,27-31;edit model Post { id Int @id @default(autoincrement()) title String @db.VarChar(255) @@ -39,7 +39,6 @@ model Post { published Boolean @default(false) authorId Int user User @relation(fields: [authorId], references: [id]) - //edit-next-line tags Tag[] } @@ -58,13 +57,11 @@ 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: @@ -110,3 +107,25 @@ 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 6a95a6d23e..edf01530c3 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 showLineNumbers +```prisma file=prisma/schema.prisma highlight=9,27-31;edit model Post { id Int @id @default(autoincrement()) title String @db.VarChar(255) @@ -38,7 +38,6 @@ model Post { published Boolean @default(false) authorId Int user User @relation(fields: [authorId], references: [id]) - //edit-next-line tags Tag[] } @@ -57,13 +56,11 @@ 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: @@ -111,3 +108,25 @@ 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 3d51bcafaf..42840697d6 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 showLineNumbers +```prisma file=prisma/schema.prisma highlight=9,27-31;edit model Post { id Int @id @default(autoincrement()) title String @db.VarChar(255) @@ -39,7 +39,6 @@ model Post { published Boolean @default(false) authorId Int user User @relation(fields: [authorId], references: [id]) - //edit-next-line tags Tag[] } @@ -58,13 +57,11 @@ 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: @@ -81,7 +78,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, @@ -110,3 +107,25 @@ 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 16c076d967..9f5d41a541 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,3 +73,16 @@ 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 9aef7d576f..f33980c619 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,3 +74,16 @@ 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 f526779fe1..3e487ef8ad 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 showLineNumbers +```prisma file=prisma/schema.prisma datasource db { provider = "mongodb" url = env("DATABASE_URL") @@ -51,3 +51,25 @@ 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 348771fc99..758425efe7 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 showLineNumbers +```prisma file=prisma/schema.prisma datasource db { provider = "mongodb" url = env("DATABASE_URL") @@ -50,3 +50,24 @@ 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 c0149ac14a..e29de21457 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 showLineNumbers +```prisma file=prisma/schema.prisma 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 showLineNumbers +```prisma file=prisma/schema.prisma 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 showLineNumbers +```prisma file=prisma/schema.prisma highlight=14;add|20;add datasource db { provider = "mongodb" url = env("DATABASE_URL") @@ -113,14 +113,12 @@ 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[] } ``` @@ -133,3 +131,24 @@ 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 27932758cf..4407f4439b 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 showLineNumbers +```prisma file=prisma/schema.prisma 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 showLineNumbers +```prisma file=prisma/schema.prisma 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 showLineNumbers +```prisma file=prisma/schema.prisma highlight=14;add|20;add datasource db { provider = "mongodb" url = env("DATABASE_URL") @@ -112,14 +112,12 @@ 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,3 +129,25 @@ 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 01042e9488..03bbab4bee 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,3 +30,25 @@ 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 eb32fd3794..6c1e9c39c7 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,3 +28,25 @@ 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 699284a996..ae69e13aa1 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,3 +220,19 @@ 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 7bb9ade094..93c8adba26 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 showLineNumbers +```ts file=index.ts 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 showLineNumbers +```ts file=index.ts copy 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 showLineNumbers +```ts no-lines 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 showLineNumbers +```ts file=index.ts copy async function main() { await prisma.post.update({ where: { @@ -234,3 +234,25 @@ 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 edad60df07..321b715346 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. -
+