Skip to content
Home / Migrations / Prisma + PlanetScaleDrizzle ORM + Neon

Prisma + PlanetScale Drizzle ORM + Neon

medium

PlanetScale killed its free tier, prompting many to move to Neon (serverless Postgres). Drizzle is lighter than Prisma and Neon-native with HTTP driver support for edge environments.

Estimated: 6-12h · 6 steps
Progress0%
Step 1: Set up Neon project

Create project at neon.tech. Get connection string. Neon supports branching for dev/staging — create a dev branch.

npm install drizzle-orm @neondatabase/serverless && npm install -D drizzle-kit
Step 2: Write Drizzle schema

Translate Prisma schema to Drizzle table definitions.

import { pgTable, serial, text, timestamp } from 'drizzle-orm/pg-core'
export const users = pgTable('users', { id: serial('id').primaryKey(), email: text('email').notNull().unique() })
Step 3: Set up Drizzle config
// drizzle.config.ts
export default { schema: './src/db/schema.ts', out: './drizzle', dialect: 'postgresql', dbCredentials: { url: process.env.DATABASE_URL! } }
Step 4: Generate and apply migrations
npx drizzle-kit generate && npx drizzle-kit migrate
Step 5: Replace Prisma client with Drizzle

prisma.user.findMany() → db.select().from(users). prisma.user.create() → db.insert(users).values({}).

import { neon } from '@neondatabase/serverless'
import { drizzle } from 'drizzle-orm/neon-http'
const sql = neon(process.env.DATABASE_URL!)
export const db = drizzle(sql)
Step 6: Migrate data from PlanetScale

mysqldump from PlanetScale, pgloader to convert MySQL → PostgreSQL, then load into Neon.

All data present, queries return correct results

What this migration involves

Moving from Prisma + PlanetScale to Drizzle ORM + Neon is rated medium and takes about 6-12h on a typical project. The guide breaks it into 6 steps, 5 of which ship with runnable commands and 1 with a verification check.

FAQ

How long does migrating from Prisma + PlanetScale to Drizzle ORM + Neon take?

Around 6-12h for a typical project — 6 steps, difficulty rated medium, 5 of them with copy-paste commands.

Is moving from Prisma + PlanetScale to Drizzle ORM + Neon reversible?

No reverse guide is tracked yet, so treat this as a one-way move and keep a full export of your Prisma + PlanetScale data before you start.

What does Drizzle ORM + Neon cost compared to Prisma + PlanetScale?

Pricing for both tools is contact-based or not tracked yet.