Skip to content

Commit

Permalink
Clarifies instructions for PPg migration guide
Browse files Browse the repository at this point in the history
  • Loading branch information
nurul3101 committed Feb 14, 2025
1 parent 3e2bb9a commit 6cb8955
Show file tree
Hide file tree
Showing 4 changed files with 28 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -163,11 +163,16 @@ You'll also need the Prisma Postgres connection URL from step 1, it should look
prisma+postgres://accelerate.prisma-data.net/?api_key=ey...
```

Open your terminal and set the `DATABASE_URL` environment variable to the value of your Prisma Postgres database URL (replace the `__API_KEY__` placeholder with the API key of your actual database connection URL):
If you already have a `.env` file in your current directory with `DATABASE_URL` set, the tunnel CLI will automatically pick it up, no need to manually export it. However, if you haven't set up a `.env` file, you'll need to set the `DATABASE_URL` environment variable explicitly.

To set the environment variable - open your terminal and set the `DATABASE_URL` environment variable to the value of your Prisma Postgres database URL (replace the `__API_KEY__` placeholder with the API key of your actual database connection URL):

```terminal
export DATABASE_URL="prisma+postgres://accelerate.prisma-data.net/?api_key=__API_KEY__"
```
:::note
If you explicitly set `DATABASE_URL` in your terminal, that value will take precedence over the one in your `.env` file.
:::

Next, start the TCP tunnel:

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -49,13 +49,18 @@ You'll need the Prisma Postgres connection URL from [step 1](/getting-started/pr
```no-copy
prisma+postgres://accelerate.prisma-data.net/?api_key=ey...
```
If you already have a `.env` file in your current directory with `DATABASE_URL` set, the tunnel CLI will automatically pick it up, no need to manually export it. However, if you haven't set up a `.env` file, you'll need to set the `DATABASE_URL` environment variable explicitly.

Open your terminal and set the `DATABASE_URL` environment variable to the value of your Prisma Postgres database URL (replace the `__API_KEY__` placeholder with the API key of your actual database connection URL):
To set the environment variable - open your terminal and set the `DATABASE_URL` environment variable to the value of your Prisma Postgres database URL (replace the `__API_KEY__` placeholder with the API key of your actual database connection URL):

```terminal
export DATABASE_URL="prisma+postgres://accelerate.prisma-data.net/?api_key=__API_KEY__"
```

:::note
If you explicitly set `DATABASE_URL` in your terminal, that value will take precedence over the one in your `.env` file.
:::

Next, start the TCP tunnel using the `@prisma/ppg-tunnel` package, by executing the following command:

<CodeWithResult outputResultText="" expanded={true}>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -75,15 +75,23 @@ which pg_restore
If you installed PostgreSQL but still see a “command not found” error for pg_dump or pg_restore, ensure your installation directory is in your system’s PATH environment variable.
:::

:::note
Please make sure that you are installing Postgresql version 16. Other versions may cause errors during the backup and restore process.
:::

### 1.2. Connecting to the EA database directly with `@prisma/ppg-tunnel`

In your terminal, run `npx @prisma/ppg-tunnel` to establish a secure tunnel to your Early Access database.

Set environment variable (with your actual EA database URL):
If you already have a `.env` file in your current directory with `DATABASE_URL` set, the tunnel CLI will automatically pick it up—no need to manually export it. However, if you haven't set up a `.env` file, you'll need to set the `DATABASE_URL` environment variable explicitly.

To set environment variable (with your actual EA database URL):
```bash
export DATABASE_URL="prisma+postgres://accelerate.prisma-data.net/?api_key=eyJhbGciOiJIUzI..."
```
:::note
If you explicitly set `DATABASE_URL` in your terminal, that value will take precedence over the one in your `.env` file.
:::

Run the tunnel:
```bash
Expand Down
8 changes: 7 additions & 1 deletion content/250-postgres/700-tooling.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,9 @@ You can connect to your Prisma Postgres instance using third party database edit

### 1. Create a TCP tunnel to access Prisma Postgres directly

In your terminal, set the environment variable `DATABASE_URL` referring to your Prisma Postgres instance which you want to connect to (be sure to replace the `API_KEY` placeholder with the API key value of your Prisma Postgres instance):
If you already have a `.env` file in your current directory with `DATABASE_URL` set, the tunnel CLI will automatically pick it up, no need to manually export it. However, if you haven't set up a `.env` file, you'll need to set the `DATABASE_URL` environment variable explicitly.

In your terminal, to set the environment variable `DATABASE_URL` referring to your Prisma Postgres instance which you want to connect to (be sure to replace the `API_KEY` placeholder with the API key value of your Prisma Postgres instance):

<TabbedContent code>

Expand All @@ -53,6 +55,10 @@ set DATABASE_URL="prisma+postgres://accelerate.prisma-data.net/?api_key=API_KEY"

</TabbedContent>

:::note
If you explicitly set `DATABASE_URL` in your terminal, that value will take precedence over the one in your `.env` file.
:::

Run the following command to connect to your Prisma Postgres instance via `@prisma/ppg-tunnel` package:

<CodeWithResult outputResultText="" expanded={true}>
Expand Down

0 comments on commit 6cb8955

Please sign in to comment.