Skip to content

Commit

Permalink
fix: add steps to perform mirgations
Browse files Browse the repository at this point in the history
  • Loading branch information
ankur-arch committed Oct 23, 2023
1 parent 2b7df56 commit f06f1a4
Showing 1 changed file with 21 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -148,13 +148,26 @@ To get started, sign up for a free [Prisma Data Platform account](https://consol

## 5. Set the Accelerate connection string in your environment

1. Add the Prisma Accelerate connection string to your local environment `.env` file.
1. Add the Prisma Accelerate connection string to your local environment `.env` file and the `DIRECT_URL` environment variable to perform migrations and intropspections.

```diff file=.env
+DATABASE_URL="prisma://accelerate.prisma-data.net/?api_key=__API_KEY__"
+DIRECT_URL="postgres://..."
-DATABASE_URL="postgres://..."
```

Add [`directUrl`](/reference/api-reference/prisma-schema-reference#fields) property in `datasource` block in the `schema.prisma` file.

```diff file=prisma/schema.prisma
datasource db {
provider = "postgresql"
url = env("DATABASE_URL")
directUrl = env("DIRECT_URL")
}
```

> The `directUrl` field is not required for Prisma Accelerate. It allows you to easily perform database migrations and introspections.
2. In your code editor, add the connection string in the `wrangler.toml` file.

```diff file=wrangler.toml
Expand All @@ -174,7 +187,13 @@ To get started, sign up for a free [Prisma Data Platform account](https://consol

You are now ready to generate a Prisma Client.

## 6. Generate a Prisma Client
## 6. Migrate your schema and generate a Prisma Client

To apply migrations execute the following command:

```
prisma migrate deploy
```

Next, you'll generate Prisma Client that connects to your database through [Prisma Accelerate](/data-platform/accelerate) over HTTP.

Expand Down

0 comments on commit f06f1a4

Please sign in to comment.