Commit 39b12dd
committed
chore(web/scripts): migration runner using @neondatabase/serverless
Single-file Node script that loads NEON_DATABASE_URL via
`node --env-file=.env.local`, splits a drizzle migration on the
`--> statement-breakpoint` marker, and runs each statement over
the existing HTTP driver.
Useful because:
- psql isn't always installed on dev machines (this came up
when shipping migration 0022).
- .claude/rules/db-migrations.md mandates manual application
against prod — this script is the manual path without
requiring brew/libpq.
- The same driver the runtime uses, so behavior is consistent
with what production would see.
Usage:
node --env-file=.env.local scripts/run-migration.mjs \\
src/db/migrations/0022_ai_tagging.sql
Reports per-statement OK/FAIL and bails on first error. Does not
write to a migrations journal — drizzle-kit owns _journal.json,
this is just for the apply step.1 parent 3a591bf commit 39b12dd
1 file changed
Lines changed: 50 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
| 41 | + | |
| 42 | + | |
| 43 | + | |
| 44 | + | |
| 45 | + | |
| 46 | + | |
| 47 | + | |
| 48 | + | |
| 49 | + | |
| 50 | + | |
0 commit comments