From PostgreSQL to SQLite in Rails
summary
Migrating a Rails monolith from Postgres to SQLite reduces infra cost by an order of magnitude and cuts average request latency ~50% while keeping deployments as simple as bundling the app. Migration steps include converting Postgres-only types to strings or JSON, dropping and later rewriting check constraints, and running a data conversion script; backups use Litestream to Cloudflare R2 for point‑in‑time recovery. Real case: migrated <2GB DB with <3M rows, uses sqlean extensions for missing SQL functions, and the setup works in production with single-writer limits mitigated by vertical scaling and multiple DB files.
AI-written summary · about
