npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

drizzle-migrate-neon-http

v0.2.0

Published

Run Drizzle SQL migrations on Neon's serverless HTTP driver — no multi-statement SQL, no local Postgres emulation, no night sweats.

Readme

drizzle-migrate-neon-http

Run Drizzle SQL migrations on Neon's serverless HTTP driver — no multi-statement SQL, no local Postgres emulation, no night sweats.

npm version npm downloads License: MIT Node Docs CI PRs Welcome


📚 Full documentation: gtnorbeat.github.io/drizzle‑migrate‑neon‑http — getting started, CLI reference and API docs.


Why does this exist?

@neondatabase/serverless v1+ only works as a tagged template. You can write sql\SELECT 1``, but you cannot hand it a raw SQL string with multiple statements:

await sql(`CREATE TABLE users (...); INSERT INTO users (...) ...`);
// 💥 TypeError: "The query function does not support string arguments"

That means stock migration runners (which feed the whole migration file to the driver) break on Neon HTTP out of the box. You would need a local Postgres, a TCP tunnel, or Hyperdrive — falling back to the very thing serverless Postgres is supposed to remove.

This package runs real Drizzle migrations over HTTP, one statement at a time.

What it does

  • Reads your Drizzle meta/_journal.json to get the ordered migration list
  • Splits each .sql file into individual statements (string-literal-aware)
  • Executes them via sql.query(stmt) — the explicit, string-accepting variant
  • Skips idempotent object already exists errors so partially-applied states heal
  • Records applied files by SHA-256 in drizzle.__drizzle_migrations
  • Warns (or fails with --strict) on .sql files missing from the journal
  • Ships a CLI (--dry-run, --dir, --strict, --retries, --timeout) and an importable runner API

Requirements

  • Node.js >= 18
  • A Drizzle migrations folder, generated with drizzle-kit generate — the runner reads meta/_journal.json and the NNNN_*.sql files inside the folder
  • A Neon (or Postgres-compatible) connection string, via the DATABASE_URL environment variable or the --url flag
  • @neondatabase/serverless installed (peer dependency)

Quick start

npm install -D drizzle-migrate-neon-http @neondatabase/serverless
export DATABASE_URL="postgresql://user:[email protected]/db"

# after running `drizzle-kit generate`
drizzle-migrate-neon-http --dir ./drizzle --dry-run   # preview
drizzle-migrate-neon-http --dir ./drizzle             # apply

Hardening for CI:

# Fail fast if a migration file was generated but never registered in the
# journal (it would otherwise be silently skipped).
drizzle-migrate-neon-http --dir ./drizzle --strict

# Retry transient HTTP failures instead of failing the whole run.
drizzle-migrate-neon-http --dir ./drizzle --retries 3

# Give each query a deadline so a stalled connection fails instead of hanging.
drizzle-migrate-neon-http --dir ./drizzle --timeout 15000

Programmatic:

import { neon } from "@neondatabase/serverless";
import { runMigrations } from "drizzle-migrate-neon-http";

const sql = neon(process.env.DATABASE_URL);
await runMigrations({
  sql,
  migrationsDir: "./drizzle",
  strict: true,
  retries: 3,
  timeoutMs: 15000,
});

Journal drift — if a NNNN_*.sql file is present but missing from meta/_journal.json, the runner never applies it (it only walks the journal). By default this is surfaced as a warning; --strict turns it into a hard failure so the mistake is caught in CI rather than as a missing column in production.

Wait — there's more

The docs are hosted at gtnorbeat.github.io/drizzle-migrate-neon-http and maintained on the dedicated docs branch:

Contributing

Found a bug? Want a feature? PRs are welcome and appreciated. 🤝

  • Read the Contributing Guidelines — setup, conventions and testing in one page
  • Use the issue templates to file a bug report or feature request
  • Keep PRs small, tested (npm test) and linted (npm run lint)
  • Commit messages follow Conventional Commits (feat:, fix:, docs: …)

License

MIT © astrocat986 — see LICENSE