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

@messcat/pg-migrate

v0.1.3

Published

Easy database migrations for PostgreSQL via pg-delta

Readme

PG Migrate

Straightforward wrapper around @supabase/pg-delta. Helps make schema diffing, and forward-only migrations w/o docker, pg. Uses pglite to diff your schemas.

Install

  • npm i @messcat/pg-migrate
  • npm i @electric-sql/pglite (if you're using pglite as your spawnDb type -- the default. Skip if you plan on using Docker containers instead)

Usage - Config

The package is especially useful when working with a larger set of interconnected Postgres systems via a plugin system.

For example, you work on two systems where B depends on A. Then, when planning for migrations in B, the package can setup A as a dependency, but only write migrations for B (if it lives in a separate schema). Useful for monorepos, and cleanly managing schema changes across multiple systems.

First, create a pg-migrate.config.[ts/js/mjs] file in your project root. This should look like:

import type { PgMigrateConfig } from '@messcat/pg-migrate'
export default {
	plugins: {
		A: {
			schemas: ['system_a'],
			migrations: { directory: './packages/a/migrations' },
			current: { directory: './packages/a/schema' }
		},
		B: {
			schemas: ['system_b'],
			migrations: { directory: './packages/b/migrations' },
			current: { directory: './packages/b/schema' }
		},
	},
} satisfies PgMigrateConfig

If your shcmea needs pg contrib extensions, you can specify them in the contribExtensions field:

const config: PgMigrateConfig = {
	spawnDb: {
		type: 'pglite',
		contribExtensions: ['pgcrypto'],
	},
	...rest
}

If you want to use Docker, not pglite -- maybe you use custom extensions unavailable in pglite:

const config: PgMigrateConfig = {
	spawnDb: { type: 'docker' },
	...rest
}

You can override the default config file by setting an env var: PG_MIGRATE_CONFIG_FILE=/path/to/config.ts.

Usage - CLI

Next, you can directly fire the cli: npm run pgm <command> [options].

  1. plan --plugin <plugin name> [--name <name>]. Plans, stores a migration based on the schema diff between the migration directory and current schema directory of the specified plugin. Eg. npm run pgm plan --plugin waba --name new_index Notes:
    • uses pglite by default. Use the API to specify a different database URI.
    • will write the migration file to the migration directory as timestamped <ts>.<name>.sql (or <ts>.sql if --name is omitted).
    • --name is optional. Omitting it produces a filename of just <ts>.sql.
    • --schema is optional. Defaults to public.
    • PLEASE CHECK THE MIGRATION FILE BEFORE APPLYING.
  2. apply [--database-uri <uri>]. Applies a migration based on the schema diff between the migration directory and the database schema. If --database-uri is not specified, uses the DATABASE_URL, DB_URI environment variables. Eg. npm run pgm apply Notes:

Footnotes

Why another migration tool? This is just a wrapper on pg-delta with automatic migration generation support. pg-delta is the most comprehensive diffing tool I could find, most others lacked the features we needed (eg. functions, custom types, etc.). Plus, we needed diffs independently for multiple interdependent systems. Perhaps a niche use case, but hopefully helps someone else out.