Skip to content

chore(web/scripts): migration runner via @neondatabase/serverless#12

Merged
xiaolai merged 1 commit into
mainfrom
chore/migration-runner-script
May 6, 2026
Merged

chore(web/scripts): migration runner via @neondatabase/serverless#12
xiaolai merged 1 commit into
mainfrom
chore/migration-runner-script

Conversation

@xiaolai

@xiaolai xiaolai commented May 6, 2026

Copy link
Copy Markdown
Owner

Summary

Adds web/scripts/run-migration.mjs — a 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 (@neondatabase/serverless).

Why

  • psql isn't always installed on dev machines (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 install libpq.
  • The same driver the runtime uses → behavior consistent with production.

Usage

node --env-file=.env.local scripts/run-migration.mjs src/db/migrations/<NNNN>_<slug>.sql

Reports per-statement OK/FAIL and bails on first error. Does not touch _journal.json — drizzle-kit owns the journal; this is just the apply step.

Test plan

  • No runtime impact (script is dev-only, never imported by the app)
  • CI green

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.
@vercel

vercel Bot commented May 6, 2026

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
claudepot-com Error Error May 6, 2026 11:45pm

Request Review

@xiaolai xiaolai merged commit 14c7ff1 into main May 6, 2026
7 of 8 checks passed
xiaolai added a commit that referenced this pull request May 8, 2026
HIGH fixes:
- project.rs: skip history rewrite on unresolved CC-dir conflict (#3)
- desktop swap: add parent dir creation in snapshot/restore (#6)
- desktop swap: rollback on phase-2 failure, clean partial restores
  on phase-3 failure (#7, #8)
- cli_service: propagate UUID parse and read_default errors instead
  of silently losing credential backup (#5)

MEDIUM fixes:
- swap.rs/credfile.rs: fail-closed permission check — error if
  chmod fails instead of reading insecure file (#12, #13)
- main.rs: make --merge/--overwrite mutually exclusive via clap
  conflicts_with (#23)
- main.rs: make --from-current/--from-token mutually exclusive (#24)
- project.rs CLI: use char-safe truncation to prevent panic on
  multibyte UTF-8 paths (#25)
- doctor_service: treat 429/5xx as Unreachable, not Reachable (#19)
- account.rs: wrap set_active_cli/desktop in transactions (#21)
- project.rs: restrict prefix fallback to long paths only (#15)

LOW fixes:
- cli_ops: emit JSON for already-active account (#31)
xiaolai added a commit that referenced this pull request May 8, 2026
chore(web/scripts): migration runner via @neondatabase/serverless
xiaolai added a commit that referenced this pull request May 8, 2026
chore(web/scripts): migration runner via @neondatabase/serverless
xiaolai added a commit that referenced this pull request May 8, 2026
HIGH fixes:
- project.rs: skip history rewrite on unresolved CC-dir conflict (#3)
- desktop swap: add parent dir creation in snapshot/restore (#6)
- desktop swap: rollback on phase-2 failure, clean partial restores
  on phase-3 failure (#7, #8)
- cli_service: propagate UUID parse and read_default errors instead
  of silently losing credential backup (#5)

MEDIUM fixes:
- swap.rs/credfile.rs: fail-closed permission check — error if
  chmod fails instead of reading insecure file (#12, #13)
- main.rs: make --merge/--overwrite mutually exclusive via clap
  conflicts_with (#23)
- main.rs: make --from-current/--from-token mutually exclusive (#24)
- project.rs CLI: use char-safe truncation to prevent panic on
  multibyte UTF-8 paths (#25)
- doctor_service: treat 429/5xx as Unreachable, not Reachable (#19)
- account.rs: wrap set_active_cli/desktop in transactions (#21)
- project.rs: restrict prefix fallback to long paths only (#15)

LOW fixes:
- cli_ops: emit JSON for already-active account (#31)
xiaolai added a commit that referenced this pull request May 8, 2026
chore(web/scripts): migration runner via @neondatabase/serverless
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant