From 4b42dcda20c581da35974f24432f66dac09162c9 Mon Sep 17 00:00:00 2001 From: James Wainwright Date: Sat, 21 Oct 2023 09:46:45 +0000 Subject: [PATCH] Update drizzle.mdx to include PlanetScale instructions Instructions on how to make the t3 app work with PlanetScale --- www/src/pages/en/usage/drizzle.mdx | 29 +++++++++++++++++++++++++++-- 1 file changed, 27 insertions(+), 2 deletions(-) diff --git a/www/src/pages/en/usage/drizzle.mdx b/www/src/pages/en/usage/drizzle.mdx index aefe547554..b229b61dde 100644 --- a/www/src/pages/en/usage/drizzle.mdx +++ b/www/src/pages/en/usage/drizzle.mdx @@ -9,6 +9,31 @@ isMdx: true import Callout from "../../../components/docs/callout.tsx"; - The `drizzle` option is a new addition and no docs have yet been written. Contributions are welcome! - + The `drizzle` option is a new addition and only a small subset of the docs have been written. Contributions are welcome! + +## Configure PlanetScale + +### Setup database credentials in .env + +1. Generate a new username + password & select "connect with Prisma" +2. Copy the `DATABASE_URL` (which looks like: `DATABASE_URL='mysql://:@/?sslaccept=strict' +`) and paste it into your `.env` +3. Replace `?sslaccept=strict` with `ssl={"rejectUnauthorized":true}` + +### Update package.json `db*:` generate script + +1. Replace `:psql` with `:mysql`. + +### Update drizzle.config.ts + +1. Use the mysql2 driver: `driver: "mysql2",` + +### Run migrations + +1. Generate the migrations using `yarn db:generate` +2. Push them to PlanetScale using `yarn db:push` + +#### Seeing a timeout error? + +1. Are you on a VPN? This may be disrupting the connection.