The PlanetScale integration is in preview. To enable it for your workspace, email support@unkey.com.
How it works
Below is an example of an app with a PlanetScale database namedorders, which has a main branch and a preview branch:
- Connect your PlanetScale account to your Unkey workspace once, with OAuth. See Connect and disconnect.
- Add the
ordersdatabase to your project. It can be an existing database or one you create from the dashboard. - Connect each of your app to one branch. Here, production reads and writes
main, and preview reads and writespreview. You also pick the variable name your app reads the database URL from, such asORDERS_URL. See Production and preview for how environments and deployments relate. - Every new deployment gets its own username and password on its environment’s branch. Unkey puts the connection URL in
ORDERS_URL, plusORDERS_UNPOOLED_URLon Postgres. Production and preview use the same names, but each points at its own branch. See Environment variables. Deployments from fork pull requests get no credentials.
Limits
Next steps
Connect and disconnect
Connect your PlanetScale account and databases, and disconnect them later.
Environment variables
The URLs your app reads, and the read-only replica URL.
Migrations
Run schema changes with a PlanetScale credential.
Credentials and security
What each credential can do, when it is deleted, and how Unkey stores secrets.
Troubleshooting
Fix a disconnected account and failed deployments.