Skip to content
Home / Migrations / PlanetScaleNeon

PlanetScale Neon

medium

PlanetScale removed its free tier in 2024. Neon offers serverless PostgreSQL with scale-to-zero and database branching. Switching MySQL → PostgreSQL requires schema and query changes.

Estimated: 4-10h · 6 steps
Progress0%
Step 1: Create Neon project

Sign up at neon.tech, create a project. Note your connection string.

Step 2: Export from PlanetScale

Use mysqldump to export your schema and data.

mysqldump -h $PS_HOST -u $PS_USER -p$PS_PASS --no-tablespaces $DB_NAME > dump.sql
Step 3: Convert schema to PostgreSQL

MySQL and PostgreSQL have differences: AUTO_INCREMENT → SERIAL or GENERATED, tinyint(1) → boolean, backtick identifiers → double-quote. Use pgloader for automatic conversion.

pgloader mysql://$PS_CONNECTION_STRING postgresql://$NEON_CONNECTION_STRING
Step 4: Review and fix queries

MySQL-specific SQL: LIMIT x,y → LIMIT y OFFSET x, IFNULL → COALESCE, GROUP BY rules are stricter in PostgreSQL.

Step 5: Update ORM config

If using Prisma: change datasource provider from 'mysql' to 'postgresql'. If Drizzle: switch to drizzle-orm/neon-http.

npm install @neondatabase/serverless
Step 6: Set up branching

Use Neon branches for dev/staging environments — mirrors PlanetScale's branching workflow.

App connects, all queries return correct results
Get started with Neon