Skip to content

Commit

Permalink
Merge branch 'main' of https://github.com/prisma/docs into main
Browse files Browse the repository at this point in the history
  • Loading branch information
molebox committed Sep 14, 2021
2 parents 73ba818 + bf034e6 commit f967e70
Show file tree
Hide file tree
Showing 171 changed files with 3,457 additions and 2,928 deletions.
10 changes: 5 additions & 5 deletions config.js
Original file line number Diff line number Diff line change
Expand Up @@ -346,12 +346,12 @@ const config = {
},
{
text: 'About the docs ',
url: 'about/about-the-docs',
url: 'about/prisma-docs/about-the-docs',
codeBlock: false,
},
{
text: 'Prisma style guide',
url: 'about/style-guide',
url: 'about/prisma-docs/style-guide',
codeBlock: false,
},
{
Expand Down Expand Up @@ -380,7 +380,7 @@ const config = {
},
{
text: 'Limitations',
url: 'about/limitations',
url: 'about/prisma/limitations',
codeBlock: false,
},
{
Expand All @@ -390,12 +390,12 @@ const config = {
},
{
text: 'Roadmap',
url: 'about/roadmap',
url: 'about/prisma/roadmap',
codeBlock: false,
},
{
text: 'Releases and maturity levels',
url: 'about/releases',
url: 'about/prisma/releases',
codeBlock: false,
},
],
Expand Down
12 changes: 6 additions & 6 deletions content/100-getting-started/01-quickstart.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ npm install

The following query will read all the `User` records from the database and return all the users and their related posts.

One of the main features of Prisma Client is the ease of working with [relations](../concepts/components/prisma-schema/relations). You can retrieve the `posts` of each user by using the [`include`](../concepts/components/prisma-client/select-fields#include-relations-and-select-relation-fields) option.
One of the main features of Prisma Client is the ease of working with [relations](/concepts/components/prisma-schema/relations). You can retrieve the `posts` of each user by using the [`include`](/concepts/components/prisma-client/select-fields#include-relations-and-select-relation-fields) option.

Add the highlighted code to the main function in the `script.ts` file.

Expand Down Expand Up @@ -124,7 +124,7 @@ npm run dev

<Admonition type="info">

Note that `allUsers` is _statically typed_ thanks to [Prisma Client's generated types](../concepts/components/prisma-client/advanced-type-safety/operating-against-partial-structures-of-model-types). You can observe the type by hovering over the `allUsers` variable in your editor.
Note that `allUsers` is _statically typed_ thanks to [Prisma Client's generated types](/concepts/components/prisma-client/advanced-type-safety/operating-against-partial-structures-of-model-types). You can observe the type by hovering over the `allUsers` variable in your editor.

</Admonition>

Expand All @@ -142,14 +142,14 @@ This query asked for all the users and their blog posts. You then printed the re

## What next?

If you're interested in learning more about Prisma, the [Concepts](../../concepts) section has all the information needed to gain a deeper understanding of how Prisma works and how it can
If you're interested in learning more about Prisma, the [Concepts](/concepts) section has all the information needed to gain a deeper understanding of how Prisma works and how it can
**make you more productive** when working with databases.

If you are looking for guidance and workflows the [Guides](../../guides) section has a plethora of content that covers subjects such as [Database guides](../../guides/database), [Testing](../../guides/testing), [Deployment](../../guides/deployment) and [Optimizations](../../guides/performance-and-optimization).
If you are looking for guidance and workflows the [Guides](/guides) section has a plethora of content that covers subjects such as [Database guides](/guides/database), [Testing](/guides/testing), [Deployment](/guides/deployment) and [Optimizations](/guides/performance-and-optimization).

Alternatively, if you want to include Prisma in an **existing project** the [Add to existing project](./setup-prisma/add-to-existing-project/relational-databases-typescript-postgres) guide explains some core concepts as it guides you through integrating Prisma into your workflow.
Alternatively, if you want to include Prisma in an **existing project** the [Add to existing project](/getting-started/setup-prisma/add-to-existing-project/relational-databases-typescript-postgres) guide explains some core concepts as it guides you through integrating Prisma into your workflow.

Or perhaps you're looking at **starting a new project with Prisma**? The [Start from scratch](./setup-prisma/start-from-scratch/relational-databases-typescript-postgres) section guides you through creating a project, connecting your database and querying your data from scratch.
Or perhaps you're looking at **starting a new project with Prisma**? The [Start from scratch](/getting-started/setup-prisma/start-from-scratch/relational-databases-typescript-postgres) section guides you through creating a project, connecting your database and querying your data from scratch.

<Admonition type="info">

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ toc: false

## 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](../../../../reference/database-reference/connection-urls):
To connect your database, you need to set the `url` field of the `datasource` block in your Prisma schema to your database [connection URL](/reference/database-reference/connection-urls):

<SwitchTech technologies={['*', 'postgresql']}>

Expand All @@ -20,7 +20,7 @@ datasource db {
}
```

In this case, the `url` is [set via an environment variable](../../../../guides/development-environment/environment-variables) which is defined in `.env`:
In this case, the `url` is [set via an environment variable](/guides/development-environment/environment-variables) which is defined in `.env`:

```bash file=.env
DATABASE_URL="postgresql://johndoe:randompassword@localhost:5432/mydb?schema=public"
Expand All @@ -44,7 +44,7 @@ Here's a short explanation of each component:

If you're unsure what to provide for the `schema` parameter for a PostgreSQL connection URL, you can probably omit it. In that case, the default schema name `public` will be used.

As an example, for a PostgreSQL database hosted on Heroku, the [connection URL](../../../../reference/database-reference/connection-urls) might look similar to this:
As an example, for a PostgreSQL database hosted on Heroku, the [connection URL](/reference/database-reference/connection-urls) might look similar to this:

```bash file=.env
DATABASE_URL="postgresql://opnmyfngbknppm:XXX@ec2-46-137-91-216.eu-west-1.compute.amazonaws.com:5432/d50rgmkqi2ipus?schema=hello-prisma"
Expand Down Expand Up @@ -76,7 +76,7 @@ datasource db {
}
```

In this case, the `url` is [set via an environment variable](../../../../concepts/components/prisma-schema#accessing-environment-variables-from-the-schema) which is defined in `.env`:
In this case, the `url` is [set via an environment variable](/concepts/components/prisma-schema#accessing-environment-variables-from-the-schema) which is defined in `.env`:

```bash file=.env
DATABASE_URL="mysql://johndoe:randompassword@localhost:3306/mydb"
Expand All @@ -97,7 +97,7 @@ Here's a short explanation of each component:
- `PORT`: The port where your database server is running (typically `3306` for MySQL)
- `DATABASE`: The name of the [database](https://dev.mysql.com/doc/refman/8.0/en/creating-database.html)

As an example, for a MySQL database hosted on AWS RDS, the [connection URL](../../../../reference/database-reference/connection-urls) might look similar to this:
As an example, for a MySQL database hosted on AWS RDS, the [connection URL](/reference/database-reference/connection-urls) might look similar to this:

```bash file=.env
DATABASE_URL="mysql://johndoe:XXX@mysql–instance1.123456789012.us-east-1.rds.amazonaws.com:3306/mydb"
Expand All @@ -115,20 +115,20 @@ DATABASE_URL="mysql://root:randompassword@localhost:3306/mydb"

```prisma file=prisma/schema.prisma
datasource db {
provider = "sqlserver"
url = env("DATABASE_URL")
provider = "sqlserver"
url = env("DATABASE_URL")
}
```

In this case, the `url` is [set via an environment variable](../../../../concepts/components/prisma-schema#accessing-environment-variables-from-the-schema) which is defined in `.env`:
In this case, the `url` is [set via an environment variable](/concepts/components/prisma-schema#accessing-environment-variables-from-the-schema) which is defined in `.env`:

The following example connection URL [uses SQL authentication](../../../../concepts/database-connectors/sql-server/sql-server-local#enable-authentication-with-sql-logins-optional), but there are [other ways to format your connection URL](../../../../concepts/database-connectors/sql-server/sql-server-connection-string)
The following example connection URL [uses SQL authentication](/concepts/database-connectors/sql-server), but there are [other ways to format your connection URL](/concepts/database-connectors/sql-server)

```bash file=prisma/.env
DATABASE_URL="sqlserver://localhost:1433;database=mydb;user=sa;password=r@ndomP@$$w0rd;trustServerCertificate=true"
```

Adjust the connection URL to match your setup - see [Microsoft SQL Server connection URL](../../../../concepts/database-connectors/sql-server/sql-server-connection-string) for more information.
Adjust the connection URL to match your setup - see [Microsoft SQL Server connection URL](/concepts/database-connectors/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)`
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ toc: false

## Create database tables with Prisma Migrate

In this guide, you'll use [Prisma Migrate](../../../../concepts/components/prisma-migrate) to create the tables in your database. Add the following Prisma data model to your Prisma schema in `prisma/schema.prisma`:
In this guide, you'll use [Prisma Migrate](/concepts/components/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
model Post {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -181,9 +181,9 @@ async function main() {

</SwitchTech>

This code creates a new `User` record together with new `Post` and `Profile` records using a [nested write](../../../../concepts/components/prisma-client/relation-queries#nested-writes) query. The `User` record is connected to the two other ones via the `Post.author``User.posts` and `Profile.user``User.profile` [relation fields](../../../../concepts/components/prisma-schema/relations#relation-fields) respectively.
This code creates a new `User` record together with new `Post` and `Profile` records using a [nested write](/concepts/components/prisma-client/relation-queries#nested-writes) query. The `User` record is connected to the two other ones via the `Post.author``User.posts` and `Profile.user``User.profile` [relation fields](/concepts/components/prisma-schema/relations#relation-fields) respectively.

Notice that you're passing the [`include`](../../../../concepts/components/prisma-client/select-fields#include-relations-and-select-relation-fields) option to `findMany` which tells Prisma Client to include the `posts` and `profile` relations on the returned `User` objects.
Notice that you're passing the [`include`](/concepts/components/prisma-client/select-fields#include-relations-and-select-relation-fields) option to `findMany` which tells Prisma Client to include the `posts` and `profile` relations on the returned `User` objects.

Run the code with this command:

Expand Down Expand Up @@ -232,7 +232,7 @@ The output should look similar to this:

<SwitchTech technologies={['typescript']}>

Also note that `allUsers` is _statically typed_ thanks to [Prisma Client's generated types](../../../../concepts/components/prisma-client/advanced-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:
Also note that `allUsers` is _statically typed_ thanks to [Prisma Client's generated types](/concepts/components/prisma-client/advanced-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
const allUsers: (User & {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,11 +9,11 @@ toc: false

## Next steps

This section lists a number of potential next steps you can now take from here. Feel free to explore these or read the [Introduction](../../../../concepts/overview/what-is-prisma) page to get a high-level overview of Prisma.
This section lists a number of potential next steps you can now take from here. Feel free to explore these or read the [Introduction](/concepts/overview/what-is-prisma) page to get a high-level overview of Prisma.

### Continue exploring the Prisma Client API

You can send a variety of queries with the Prisma Client API. Check out the [API reference](../../../../concepts/components/prisma-client) and use your existing database setup from this guide to try them out.
You can send a variety of queries with the Prisma Client API. Check out the [API reference](/concepts/components/prisma-client) and use your existing database setup from this guide to try them out.

<Tip>

Expand Down Expand Up @@ -89,7 +89,7 @@ The [`prisma-examples`](https://github.com/prisma/prisma-examples/) repository c
| :------------------------------------------------------------------------------------------------------------------ | :----------- | --------------------------------------------------------------------------------------------------- |
| [`rest-nextjs-api-routes`](https://github.com/prisma/prisma-examples/tree/latest/typescript/rest-nextjs-api-routes) | Fullstack | Simple [Next.js](https://nextjs.org/) app (React) with a REST API |
| [`graphql-nextjs`](https://github.com/prisma/prisma-examples/tree/latest/typescript/graphql-nextjs) | Fullstack | Simple [Next.js](https://nextjs.org/) app (React) with a GraphQL API |
| [`graphql-apollo-server`](https://github.com/prisma/prisma-examples/tree/latest/typescript/graphql-apollo-server) | Backend only | Simple GraphQL server based on [`apollo-server`](https://www.apollographql.com/docs/apollo-server/) |
| [`graphql-apollo-server`](https://github.com/prisma/prisma-examples/tree/latest/typescript/graphql) | Backend only | Simple GraphQL server based on [`apollo-server`](https://www.apollographql.com/docs/apollo-server/) |
| [`rest-express`](https://github.com/prisma/prisma-examples/tree/latest/typescript/rest-express) | Backend only | Simple REST API with Express.JS |
| [`grpc`](https://github.com/prisma/prisma-examples/tree/latest/typescript/grpc) | Backend only | Simple gRPC API |

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ dbSwitcher: ['postgres', 'mysql', 'sqlserver']

<TopBlock>

Learn how to create a new Node.js or TypeScript project from scratch by connecting Prisma to your database and generating a Prisma Client for database access. The following tutorial introduces you to the [Prisma CLI](../../../../concepts/components/prisma-cli), [Prisma Client](../../../../concepts/components/prisma-client), and [Prisma Migrate](../../../../concepts/components/prisma-migrate).
Learn how to create a new Node.js or TypeScript project from scratch by connecting Prisma to your database and generating a Prisma Client for database access. The following tutorial introduces you to the [Prisma CLI](/concepts/components/prisma-cli), [Prisma Client](/concepts/components/prisma-client), and [Prisma Migrate](/concepts/components/prisma-migrate).

</TopBlock>

Expand All @@ -36,14 +36,14 @@ In order to successfully complete this guide, you need:

- [Node.js](https://nodejs.org/en/) installed on your machine
- A [Microsoft SQL Server](https://docs.microsoft.com/en-us/sql/?view=sql-server-ver15) database
- [Microsoft SQL Server on Linux for Docker](../../../../concepts/database-connectors/sql-server/sql-server-docker)
- [Microsoft SQL Server on Windows (local)](../../../../concepts/database-connectors/sql-server/sql-server-local)
- [Microsoft SQL Server on Linux for Docker](/concepts/database-connectors/sql-server/sql-server-docker)
- [Microsoft SQL Server on Windows (local)](/concepts/database-connectors/sql-server/sql-server-local)

</SwitchTech>

> See [System requirements](../../../../reference/system-requirements) for exact version requirements.
> See [System requirements](/reference/system-requirements) for exact version requirements.
Make sure you have your database [connection URL](../../../../reference/database-reference/connection-urls) at hand. If you don't have a database server running and just want to explore Prisma, check out the [Quickstart](../../../quickstart).
Make sure you have your database [connection URL](/reference/database-reference/connection-urls) at hand. If you don't have a database server running and just want to explore Prisma, check out the [Quickstart](/getting-started/quickstart).

<!--
Alternatively you can [set up a free PostgreSQL database on Heroku](https://dev.to/prisma/how-to-setup-a-free-postgresql-database-on-heroku-1dc1) and use it in this guide.
Expand Down Expand Up @@ -104,7 +104,7 @@ You can now invoke the Prisma CLI by prefixing it with `npx`:
npx prisma
```

Next, set up your Prisma project by creating your [Prisma schema](../../../../concepts/components/prisma-schema) file with the following command:
Next, set up your Prisma project by creating your [Prisma schema](/concepts/components/prisma-schema) file with the following command:

```terminal copy
npx prisma init
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ toc: false

## 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](../../../../../reference/database-reference/connection-urls):
To connect your database, you need to set the `url` field of the `datasource` block in your Prisma schema to your database [connection URL](/reference/database-reference/connection-urls):

```prisma file=prisma/schema.prisma
datasource db {
Expand All @@ -18,7 +18,7 @@ datasource db {
}
```

In this case, the `url` is [set via an environment variable](../../../../guides/development-environment/environment-variables) which is defined in `.env` (the example uses a [MongoDB Atlas](https://www.mongodb.com/cloud/atlas) URL):
In this case, the `url` is [set via an environment variable](/guides/development-environment/environment-variables) which is defined in `.env` (the example uses a [MongoDB Atlas](https://www.mongodb.com/cloud/atlas) URL):

```bash file=.env
DATABASE_URL="mongodb+srv://test:test@cluster0.ns1yp.mongodb.net/myFirstDatabase"
Expand Down Expand Up @@ -49,7 +49,7 @@ Here's a short explanation of each component:
- `PORT`: The port where your database server is running (typically `27017` for MongoDB)
- `DATABASE`: The name of the database

As an example, for a MongoDB database hosted on [MongoDB Atlas](https://www.mongodb.com/cloud/atlas), the [connection URL](../../../../reference/database-reference/connection-urls) might look similar to this:
As an example, for a MongoDB database hosted on [MongoDB Atlas](https://www.mongodb.com/cloud/atlas), the [connection URL](/reference/database-reference/connection-urls) might look similar to this:

```bash file=.env
DATABASE_URL="mongodb+srv://test:test@cluster0.ns1yp.mongodb.net/myFirstDatabase"
Expand Down
Loading

0 comments on commit f967e70

Please sign in to comment.