Skip to content
Home / Migrations / SQLitePostgreSQL

SQLite PostgreSQL

medium

SQLite is excellent for development and single-server apps. PostgreSQL is needed for multi-server, high concurrency, or cloud-native deployments.

Estimated: 3-6h · 6 steps
Progress0%
Step 1: Set up PostgreSQL

Use Neon, Supabase, or Railway for managed Postgres. Or install locally.

docker run -d -p 5432:5432 -e POSTGRES_PASSWORD=pass postgres:16
Step 2: Convert schema

SQLite → PostgreSQL differences: AUTOINCREMENT → SERIAL. BLOB → BYTEA. TEXT for dates → TIMESTAMP. No IF NOT EXISTS issues.

Step 3: Export SQLite data
sqlite3 mydb.sqlite .dump > dump.sql
Step 4: Fix and import dump

Edit dump.sql to remove SQLite-specific syntax. Import to Postgres.

psql $DATABASE_URL < dump.sql
Step 5: Update ORM config

Drizzle: change client import from 'drizzle-orm/better-sqlite3' to 'drizzle-orm/postgres-js'. Prisma: change provider to 'postgresql'.

Step 6: Test concurrent connections
App handles concurrent requests correctly. All queries return expected results.