Database
Switch to PlanetScale
How to change the database provider to PlanetScale.
Here’s how to switch from Neon to PlanetScale.
1. Create a new database on PlanetScale
Once you create a database on PlanetScale, you will get a connection string. It will look something like this:
Keep this connection string handy, you will need it in the next step.
2. Update your environment variables
Update your environment variables to use the new PlanetScale connection string:
apps/database/.env
apps/app/.env.local
Etcetera.
3. Swap out the required dependencies in @repo/database
Uninstall the existing dependencies…
Terminal
…and install the new ones:
Terminal
4. Update the database connection code
Update the database connection code to use the new PlanetScale adapter:
packages/database/index.ts
5. Update your Prisma schema
Update your Prisma schema to use the new database provider:
packages/database/prisma/schema.prisma
6. Add a dev
script
Add a dev
script to your package.json
:
packages/database/package.json