Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion content/100-getting-started/01-quickstart.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ For demonstration purposes of this guide, you will use a local [SQLite](https://

If you're looking to set up Prisma with your own database, you have these options:

- [Set up a new project with Prisma from scratch](setup-prisma/start-from-scratch-sql)
- [Set up a new project with Prisma from scratch](setup-prisma/start-from-scratch)
- [Add Prisma to an existing project](setup-prisma/add-to-existing-project)

</details>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -154,7 +154,7 @@ The resulting `user` object is an instance of Sequelize's `Model` class (because

## Data modeling with Prisma

Depending on which parts of Prisma you want to use in your application, the data modeling flow looks slightly different. The following two sections explain the workflows for using [**only Prisma Client**](#using-only-prisma-client) and using [**Prisma Client and Prisma Migrate (Preview)**](##using-prisma-client-and-prisma-migrate-preview).
Depending on which parts of Prisma you want to use in your application, the data modeling flow looks slightly different. The following two sections explain the workflows for using [**only Prisma Client**](#using-only-prisma-client) and using [**Prisma Client and Prisma Migrate (Preview)**](#using-prisma-client-and-prisma-migrate-preview).

No matter which approach though, with Prisma you never create application models in your programming language by manually defining classes, interfaces, or structs. Instead, the application models are defined in your [Prisma schema](../../components/prisma-schema):

Expand Down Expand Up @@ -213,7 +213,7 @@ Here is an overview of the main workflow:
1. Run `prisma introspect` to introspect the database and add application models to the Prisma schema
1. Run `prisma generate` to update your Prisma Client API

### Using Prisma Client and Prisma Migrate (Experimental)
### Using Prisma Client and Prisma Migrate (Preview)

> **Warning**: Prisma Migrate is currently in an Experimental state. It is ready to be tested and can be used in non-critical projects. However, it is not yet considered ready for production usage.

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ The setup instructions [below](#set-up) provide a high-level overview of the ste

<ButtonLink
color="dark"
type="primary"
type="primary"
href="../../../getting-started/setup-prisma/start-from-scratch-sql"
>
Set up a new project from scratch
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ Use the following command in non-development environments to apply migrations:
prisma migrate deploy --preview-feature
```

The `prisma migrate dev --preview-feature` command is reserved for development environments and requires the [shadow database](../#shadow-database), which is not available in production.
The `prisma migrate dev --preview-feature` command is reserved for development environments and requires the [shadow database](./#shadow-database), which is not available in production.

## Collaborating with a team

Expand Down Expand Up @@ -110,7 +110,7 @@ If Prisma Migrate detects a migration history conflict when you run `prisma migr

Database schema drift occurs when your database schema is out of sync with your migration history - the database schema has 'drifted away' from the source of truth. Schema drift can occur if:

* The database schema was changed _without_ using migrations - for example, by using [`prisma db push`](../../reference/api-reference/command-reference#db-push) or manually changing the database schema.
* The database schema was changed _without_ using migrations - for example, by using [`prisma db push`](../../../reference/api-reference/command-reference#db-push) or manually changing the database schema.

> **Note**: Schema drift can only be detected in a development environment as this requires the shadow database.

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ Legacy Prisma Migrate is a tool that lets you _change your database schema_, e.g

### Legacy Prisma Migrate vs the `db push` (Preview) command

If you want to prototype or iterate on a schema design in a development environment, consider the [`db push` command](../../../reference/api-reference/command-reference#db-push).
If you want to prototype or iterate on a schema design in a development environment, consider the [`db push` command](../../../../reference/api-reference/command-reference#db-push).

### Legacy Prisma Migrate vs SQL migrations

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -255,4 +255,4 @@ The `prisma migrate dev --preview-feature` and `prisma migrate reset --preview-f

### Native types preview not yet supported

Prisma Migrate does not yet support [native database type attributes (Preview)](preview-features/native-types).
Prisma Migrate does not yet support [native database type attributes (Preview)](../preview-features/native-types).
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ Alternatively, follow the [Microsoft SQL Server tutorial](sql-server-start-from-

### Type mappings with `nativeTypes` preview enabled

See [native types mapping reference](../../native-types/native-types-mappings).
See [native types mapping reference](../native-types/native-types-mappings).

### Type mappings with `nativeTypes` preview disabled

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,9 @@ metaDescription: Learn how to add Prisma Migrate (Preview) to an existing projec

<TopBlock>

This guide describes how to add [Prisma Migrate (Preview)](../../concepts/components/prisma-migrate) to an existing project, including upgrading from the experimental version of Prisma Migrate.
This guide describes how to add [Prisma Migrate (Preview)](../../../concepts/components/prisma-migrate) to an existing project, including upgrading from the experimental version of Prisma Migrate.

For users who are transitioning from the experimental Prisma Migrate, the flow is conceptually very similar.
* For users who are transitioning from the experimental Prisma Migrate, the flow is conceptually very similar.
* For users coming from a third party migration tool, the flow differs from the old "introspection flow". With Prisma Migrate (Preview), you no longer modify your database schema and then use `prisma introspect` to pull the changes into your Prisma schema.

</TopBlock>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -873,7 +873,7 @@ Prisma 1 supports configuration of cascading deletes via the `@relation(onDelete

If your relation is configured via `table: INLINE`, you can still get the same behaviour by configuring cascading deletes directly in your database. If your relation is represented via a relation table, you need to manually implement cascading deletes in your application code.

Cascading deletes are not yet supported in Prisma 2. For _inline_ relations, you can configure similar behaviour as in Prisma 1 in plain SQL (find the guides [here](../../database-workflows/cascading-deletes/postgresql)). For relations that were represented as relation tables in Prisma 1, you won't be able to configure cascading deletes on the database layer for now and might have to resort to implementing it inside your application code with Prisma Client.
Cascading deletes are not yet supported in Prisma 2. For _inline_ relations, you can configure similar behaviour as in Prisma 1 in plain SQL (find the guides [here](../../general-guides/database-workflows/cascading-deletes/postgresql)). For relations that were represented as relation tables in Prisma 1, you won't be able to configure cascading deletes on the database layer for now and might have to resort to implementing it inside your application code with Prisma Client.

> **Note**: If you need to implement cascading deletes in your application layer, this [tool](https://paljs.com/plugins/delete) by our community member [Ahmed Elywa](https://github.com/AhmedElywa/) might come in handy.

Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ Because Graphcool and and Prisma 2 are very different, it might be a viable opti
On a high-level, the migration path from Graphcool to Prisma 2 looks as follows:

1. Create SQL dump of Graphcool project using the [Graphcool Exporter](https://export.graph.cool/)
1. [Import](../database-workflows/import-and-export-data/mysql) the dump into a MySQL database
1. [Import](https://www.prisma.io/dataguide/mysql/importing-and-exporting-data-in-mysql) the dump into a MySQL database
1. [Introspect](../../concepts/components/introspection) your database with Prisma 2.0
1. Create CRUD GraphQL API with [Nexus](https://nexusjs.org) (and optionally [`nexus-plugin-prisma`](https://github.com/graphql-nexus/nexus-plugin-prisma))

Expand All @@ -58,10 +58,10 @@ Open the Graphcool Exporter at [`https://export.graph.cool/`](https://export.gra
Then grab your permanent auth token from the **Settings > Authentication > Permanent Auth Tokens** area in the [Graphcool console](https://console.graph.cool) and paste it into the text field. Now click **Export**.

This downloads a zipped `.sql` file with a dump of all the data that's stored in your Graphcool project.

## 2. Import the SQL dump into your own MySQL database

Follow the [guide](../database-workflows/import-and-export-data/mysql#importing-data-from-sql-files) that explains how to import data into a MySQL database.
Follow the [guide](https://www.prisma.io/dataguide/postgresql/inserting-and-modifying-data/importing-and-exporting-data-in-postgresql#importing-data-from-sql-files) that explains how to import data into a MySQL database.

## 3. Introspect your database with Prisma 2

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ You can learn how Prisma compares to TypeORM on the [Prisma vs TypeORM](../../co
## Overview of the migration process

Note that the steps for migrating from TypeORM to Prisma are always the same, no matter what kind of application or API layer you're building:

1. Install the Prisma CLI
1. Introspect your database
1. Install Prisma Client
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -192,7 +192,7 @@ npm init -y
npm install @prisma/cli --save-dev
```

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 All @@ -203,16 +203,16 @@ This command created a new directory called `prisma` with the following contents
- `schema.prisma`: The Prisma schema with your database connection and the Prisma Client generator
- `.env`: A [dotenv](https://github.com/motdotla/dotenv) file for defining environment variables (used for your database connection)

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 {
provider = "postgresql"
url = env("DATABASE_URL")
}
```

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

```js file=prisma/.env
DATABASE_URL="postgresql://johndoe:randompassword@localhost:5432/mydb?schema=public"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ toc: false

A foreign key links data in one table to data in another table. For example, records in a `Posts` table might have a foreign key named `authorId` that refers to the `id` column of the `User` table. This relationship makes it possible to, for example, find all blog posts by a particular author.

The Prisma schema represents tables as models, and connections between two models are called [relations](../../../concepts/components/prisma-schema/relations). You can [filter and query by relations](../../../concepts/components/prisma-client/relation-queries) - for example, you can get all posts where the author's email address contains _"prisma.io"_.
The Prisma schema represents tables as models, and connections between two models are called [relations](../../../../concepts/components/prisma-schema/relations). You can [filter and query by relations](../../../../concepts/components/prisma-client/relation-queries) - for example, you can get all posts where the author's email address contains _"prisma.io"_.

This section describes how to configure foreign key relationships for different databases. When you introspect a database, these relationships are represented in the Prisma schema as **relations**.

Expand Down