From f06f1a47a0ae703ae1ba44cadfd5ea157854ba60 Mon Sep 17 00:00:00 2001 From: Ankur Datta Date: Mon, 23 Oct 2023 18:18:42 +0200 Subject: [PATCH] fix: add steps to perform mirgations --- .../450-deploy-to-cloudflare-workers.mdx | 23 +++++++++++++++++-- 1 file changed, 21 insertions(+), 2 deletions(-) diff --git a/content/300-guides/200-deployment/301-edge/450-deploy-to-cloudflare-workers.mdx b/content/300-guides/200-deployment/301-edge/450-deploy-to-cloudflare-workers.mdx index 381ff0d329..b8fe083766 100644 --- a/content/300-guides/200-deployment/301-edge/450-deploy-to-cloudflare-workers.mdx +++ b/content/300-guides/200-deployment/301-edge/450-deploy-to-cloudflare-workers.mdx @@ -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 @@ -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.