Skip to content

Commit 2115d96

Browse files
committed
planetscale cleanup
1 parent 7b82112 commit 2115d96

File tree

2 files changed

+28
-37
lines changed

2 files changed

+28
-37
lines changed

src/content/docs/hyperdrive/examples/connect-to-postgres/postgres-database-providers/planetscale-postgres.mdx

Lines changed: 28 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,4 +12,31 @@ import { Render } from "~/components";
1212

1313
This example shows you how to connect Hyperdrive to a [PlanetScale](https://planetscale.com/) PostgreSQL database.
1414

15-
<Render file="planetscale-postgres-partial" />
15+
## 1. Allow Hyperdrive access
16+
17+
You can connect Hyperdrive to any existing PlanetScale PostgreSQL database by creating a new role (optional) and retrieving a connection string to your database.
18+
19+
### PlanetScale Dashboard
20+
21+
1. Go to the [**PlanetScale dashboard**](https://app.planetscale.com/) and select the database you wish to connect to.
22+
2. Click **Connect**.
23+
3. Create a new role for your Hyperdrive configuration (recommended):
24+
1. Ensure the minimum required permissions for Hyperdrive to read and write data to your tables:
25+
- **pg_read_all_data** - Read data from all tables, views, and sequences
26+
- **pg_write_all_data** - Write data to all tables, views, and sequences
27+
2. Click **Create role**.
28+
4. Note the user, the password, the database host, and the database name (or `postgres` as the default database). You will need these to create a database configuration in Hyperdrive.
29+
30+
With the host, database name, username and password, you can now create a Hyperdrive database configuration.
31+
32+
## 2. Create a database configuration
33+
34+
<Render file="create-hyperdrive-config" product="hyperdrive" />
35+
36+
:::note
37+
38+
When connecting to a PlanetScale PostgreSQL database with Hyperdrive, you should use a driver like [node-postgres (pg)](/hyperdrive/examples/connect-to-postgres/postgres-drivers-and-libraries/node-postgres/) or [Postgres.js](/hyperdrive/examples/connect-to-postgres/postgres-drivers-and-libraries/postgres-js/) to connect directly to the underlying database instead of the [PlanetScale serverless driver](https://planetscale.com/docs/tutorials/planetscale-serverless-driver). Hyperdrive is optimized for database access for Workers and will perform global connection pooling and fast query routing by connecting directly to your database.
39+
40+
:::
41+
42+
<Render file="create-hyperdrive-config-next-steps" product="hyperdrive" />

src/content/partials/hyperdrive/planetscale-postgres-partial.mdx

Lines changed: 0 additions & 36 deletions
This file was deleted.

0 commit comments

Comments
 (0)