[{"data":1,"prerenderedAt":-1},["ShallowReactive",2],{"blog-en-orm-migrations-serverless-criteria":3},{"id":4,"title":5,"author":6,"body":7,"cover":500,"description":501,"draft":502,"extension":503,"locale":504,"meta":505,"navigation":506,"path":507,"publishedAt":508,"seo":509,"seoTitle":510,"slug":511,"stem":512,"tags":513,"__hash__":515},"blog\u002Fen\u002Fblog\u002Form-migrations-serverless-criteria.md","ORMs and migrations on serverless: operational criteria","Manuel Tardivo",{"type":8,"value":9,"toc":489},"minimark",[10,43,48,90,94,97,128,143,147,161,168,172,179,183,237,337,348,355,380,384,419,426,436,440,451,455,466,485],[11,12,13,14,18,19,22,23,22,26,29,30,33,34,37,38,42],"p",{},"Prisma, Drizzle, TypeORM (and friends) compete on DX. On ",[15,16,17],"strong",{},"serverless Node"," the decisive factors are usually ",[15,20,21],{},"cold bundle weight",", ",[15,24,25],{},"migration workflow",[15,27,28],{},"database connections",", and ",[15,31,32],{},"predictable query plumbing",". This article proposes a ",[15,35,36],{},"scoring grid",", not a universal champion—it depends on your DB host (Neon, RDS Proxy, SQLite), runtime (Lambda, Cloud Run, Nitro ",[39,40,41],"code",{},"node-server","), and the exact library version you pin.",[44,45,47],"h2",{"id":46},"serverless-constraints","Serverless constraints",[49,50,51,66,76],"ul",{},[52,53,54,57,58,61,62,65],"li",{},[15,55,56],{},"Cold start",": heavy imports (",[39,59,60],{},"@prisma\u002Fclient"," artifacts, TypeORM ",[39,63,64],{},"reflect-metadata",") add milliseconds before your handler runs.",[52,67,68,71,72,75],{},[15,69,70],{},"Connections",": without a pooler each Lambda instance may open N sockets—use ",[15,73,74],{},"PgBouncer\u002FNeon pool"," or cap concurrency.",[52,77,78,81,82,85,86,89],{},[15,79,80],{},"Filesystem",": some ORMs expect local ",[39,83,84],{},"schema"," files; immutable containers require ",[15,87,88],{},"baking"," assets or running migrations in the deploy phase, not during cold boot.",[44,91,93],{"id":92},"migrations-ownership","Migrations: ownership",[11,95,96],{},"Score each 1–5:",[98,99,100,111,118,125],"ol",{},[52,101,102,103,106,107,110],{},"Migrations are ",[15,104,105],{},"versioned files"," applied in CI (",[39,108,109],{},"migrate deploy",")?",[52,112,113,114,117],{},"Can you ",[15,115,116],{},"squash"," or trim long histories safely?",[52,119,120,121,124],{},"Is there ",[15,122,123],{},"drift detection"," between DB and expected schema?",[52,126,127],{},"Is rollback documented, or forward-only acceptable?",[11,129,130,131,134,135,138,139,142],{},"Drizzle tends to be SQL-first with explicit TS\u002FSQL migrations; Prisma ships ",[39,132,133],{},"prisma migrate","; TypeORM uses CLI ",[39,136,137],{},"migration:run","—verify the docs for ",[15,140,141],{},"your"," pinned major.",[44,144,146],{"id":145},"type-safety","Type-safety",[49,148,149,155],{},[52,150,151,154],{},[15,152,153],{},"Compile-time",": generated models vs schema-inferred types.",[52,156,157,160],{},[15,158,159],{},"Runtime",": result validation (Drizzle + Zod overlays, etc.).",[11,162,163,164,167],{},"“Type-safe” marketing that devolves into ",[39,165,166],{},"any"," on raw SQL loses operational points.",[44,169,171],{"id":170},"observability","Observability",[11,173,174,175,178],{},"Can you log parameterized queries in dev without leaking PII? Is there a centralized hook (",[39,176,177],{},"$on('query')"," for Prisma, Drizzle logger) that fits your sink?",[44,180,182],{"id":181},"example-grid-with-one-real-cold-import-measurement","Example grid (with one real cold-import measurement)",[11,184,185,188,189,196,197,200,201,204,205,204,208,211,212,204,214,22,217,204,220,22,223,204,226,229,230,233,234,236],{},[15,186,187],{},"Method (May 2026, macOS arm64):"," for each library, a ",[15,190,191,192,195],{},"fresh ",[39,193,194],{},"node"," process","; Drizzle and TypeORM via ",[39,198,199],{},"await import('…')"," (ESM); Prisma via ",[39,202,203],{},"require('@prisma\u002Fclient')"," ",[15,206,207],{},"after",[39,209,210],{},"prisma generate"," on a minimal SQLite schema. Pinned versions: ",[39,213,60],{},[15,215,216],{},"6.3.0",[39,218,219],{},"drizzle-orm",[15,221,222],{},"0.39.1",[39,224,225],{},"typeorm",[15,227,228],{},"0.3.21",". Milliseconds ",[15,231,232],{},"will differ"," with CPU, disk, Node version, and other imports—re-run in ",[15,235,141],{}," deploy.",[238,239,240,262],"table",{},[241,242,243],"thead",{},[244,245,246,250,253,256,259],"tr",{},[247,248,249],"th",{},"Criterion",[247,251,252],{},"Weight",[247,254,255],{},"Prisma 6.3.0",[247,257,258],{},"Drizzle 0.39.1",[247,260,261],{},"TypeORM 0.3.21",[263,264,265,289,304,318],"tbody",{},[244,266,267,271,274,279,284],{},[268,269,270],"td",{},"Cold import (ms, new process)",[268,272,273],{},"3",[268,275,276],{},[15,277,278],{},"~15",[268,280,281],{},[15,282,283],{},"~73",[268,285,286],{},[15,287,288],{},"~85",[244,290,291,294,296,299,302],{},[268,292,293],{},"Migration story (1–5, subjective)",[268,295,273],{},[268,297,298],{},"5",[268,300,301],{},"4",[268,303,273],{},[244,305,306,309,312,314,316],{},[268,307,308],{},"Query DX (1–5, subjective)",[268,310,311],{},"2",[268,313,298],{},[268,315,301],{},[268,317,273],{},[244,319,320,328,330,333,335],{},[268,321,322,323,327],{},"Bundle weight (1–5, ",[324,325,326],"em",{},"you measure",")",[268,329,311],{},[268,331,332],{},"—",[268,334,332],{},[268,336,332],{},[11,338,339,340,343,344,347],{},"Fill the ",[15,341,342],{},"bundle"," row with ",[39,345,346],{},"webpack-bundle-analyzer"," \u002F Rolldown output or your host’s serverless bundle report—we do not have one canonical app here.",[11,349,350,351,354],{},"Quick Prisma timing (same process, after ",[39,352,353],{},"generate","):",[356,357,362],"pre",{"className":358,"code":359,"language":360,"meta":361,"style":361},"language-bash shiki shiki-themes github-light github-dark","node -e \"const {performance}=require('node:perf_hooks');const t=performance.now();require('@prisma\u002Fclient');console.log((performance.now()-t).toFixed(1)+' ms')\"\n","bash","",[39,363,364],{"__ignoreMap":361},[365,366,369,372,376],"span",{"class":367,"line":368},"line",1,[365,370,194],{"class":371},"sScJk",[365,373,375],{"class":374},"sj4cs"," -e",[365,377,379],{"class":378},"sZZnC"," \"const {performance}=require('node:perf_hooks');const t=performance.now();require('@prisma\u002Fclient');console.log((performance.now()-t).toFixed(1)+' ms')\"\n",[44,381,383],{"id":382},"tcp-drivers-vs-httpwebsocket-serverless-drivers-postgres","TCP drivers vs HTTP\u002FWebSocket “serverless” drivers (Postgres)",[11,385,386,387,390,391,400,401,404,405,408,409,412,413,418],{},"Serverless pain is often ",[15,388,389],{},"TCP connection storms",", not ORM ergonomics. Prisma documents separate ",[392,393,397],"a",{"href":394,"rel":395},"https:\u002F\u002Fwww.prisma.io\u002Fdocs\u002Form\u002Foverview\u002Fdatabases\u002Fdatabase-drivers",[396],"nofollow",[15,398,399],{},"database drivers"," and ",[15,402,403],{},"serverless adapters","; the canonical Neon pairing (",[39,406,407],{},"@prisma\u002Fadapter-neon"," + ",[39,410,411],{},"@neondatabase\u002Fserverless"," over WebSockets) is spelled out in ",[392,414,417],{"href":415,"rel":416},"https:\u002F\u002Fwww.prisma.io\u002Fdocs\u002Form\u002Foverview\u002Fdatabases\u002Fneon",[396],"Prisma × Neon",". Pick the analogous path if you deploy to Turso\u002FlibSQL or other vendors.",[11,420,421,422,425],{},"Drizzle commonly pairs with ",[39,423,424],{},"neon-http"," or managed poolers—follow the dialect-specific quickstart.",[11,427,428,429,204,432,435],{},"Without an adapter\u002Fpooler, profile ",[39,430,431],{},"too many connections",[15,433,434],{},"before"," blaming “slow ORMs.”",[44,437,439],{"id":438},"serverless-sqlite","Serverless + SQLite",[11,441,442,443,446,447,450],{},"Embedded SQLite (",[39,444,445],{},"better-sqlite3",") changes the comparison matrix versus hosted Postgres. Drizzle’s SQLite support is a first-class path; Prisma and TypeORM each carry different tradeoffs. Do not trust “ORM generic” takes without naming the ",[15,448,449],{},"dialect",".",[44,452,454],{"id":453},"summary","Summary",[11,456,457,458,461,462,465],{},"Pick the ORM after ",[15,459,460],{},"measuring cold start in your actual deploy"," and deciding ",[15,463,464],{},"who owns migrations"," (CI vs runtime). Twitter politics matter less than those two constraints.",[11,467,468,469,22,474,22,479,484],{},"Docs: ",[392,470,473],{"href":471,"rel":472},"https:\u002F\u002Fwww.prisma.io\u002Fdocs",[396],"Prisma",[392,475,478],{"href":476,"rel":477},"https:\u002F\u002Form.drizzle.team\u002Fdocs\u002Foverview",[396],"Drizzle",[392,480,483],{"href":481,"rel":482},"https:\u002F\u002Ftypeorm.io\u002F",[396],"TypeORM"," for up-to-date commands.",[486,487,488],"style",{},"html pre.shiki code .sScJk, html code.shiki .sScJk{--shiki-default:#6F42C1;--shiki-dark:#B392F0}html pre.shiki code .sj4cs, html code.shiki .sj4cs{--shiki-default:#005CC5;--shiki-dark:#79B8FF}html pre.shiki code .sZZnC, html code.shiki .sZZnC{--shiki-default:#032F62;--shiki-dark:#9ECBFF}html .default .shiki span {color: var(--shiki-default);background: var(--shiki-default-bg);font-style: var(--shiki-default-font-style);font-weight: var(--shiki-default-font-weight);text-decoration: var(--shiki-default-text-decoration);}html .shiki span {color: var(--shiki-default);background: var(--shiki-default-bg);font-style: var(--shiki-default-font-style);font-weight: var(--shiki-default-font-weight);text-decoration: var(--shiki-default-text-decoration);}html .dark .shiki span {color: var(--shiki-dark);background: var(--shiki-dark-bg);font-style: var(--shiki-dark-font-style);font-weight: var(--shiki-dark-font-weight);text-decoration: var(--shiki-dark-text-decoration);}html.dark .shiki span {color: var(--shiki-dark);background: var(--shiki-dark-bg);font-style: var(--shiki-dark-font-style);font-weight: var(--shiki-dark-font-weight);text-decoration: var(--shiki-dark-text-decoration);}",{"title":361,"searchDepth":490,"depth":490,"links":491},2,[492,493,494,495,496,497,498,499],{"id":46,"depth":490,"text":47},{"id":92,"depth":490,"text":93},{"id":145,"depth":490,"text":146},{"id":170,"depth":490,"text":171},{"id":181,"depth":490,"text":182},{"id":382,"depth":490,"text":383},{"id":438,"depth":490,"text":439},{"id":453,"depth":490,"text":454},"\u002Fblog\u002F30_orm_migrations_serverless_criteria_1x.webp","A comparison grid for migrations, cold starts, and type safety across common ORMs on serverless, without crowning a universal winner.",false,"md","en",{},true,"\u002Fen\u002Fblog\u002Form-migrations-serverless-criteria","2026-06-01",{"title":5,"description":501},"ORMs and serverless migrations: criteria","orm-migrations-serverless-criteria","en\u002Fblog\u002Form-migrations-serverless-criteria",[514],"mvp","XulkYE6L2ZRZGd7hOlWwBsJb4V60oXpfGkiI9RF58Zg"]