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

xata-drift-detection

v1.0.2

Published

Schema drift detection between a Postgres database and the pgstream clone.yaml (Go implementation)

Readme

xata-drift-detection

Detect schema drift between a live PostgreSQL database and a pgstream clone.yaml transformation-rules file.

It compares the database's actual tables/columns against the tables and column_transformers declared in clone.yaml, and reports anything that is out of sync in either direction.

This package ships a small, statically-linked Go binary. The correct prebuilt binary for your platform is installed automatically as an optional dependency — no Go toolchain or compilation required.

Install

npm install xata-drift-detection
# or
pnpm add xata-drift-detection

Usage

detect-drift [schemaSnapshotJson] [cloneYaml] [outputReportJson]

| Argument | Default | Description | | --- | --- | --- | | schemaSnapshotJson | ./prod-state.json | JSON array of { "table_name": string, "columns": string[] } describing the database schema | | cloneYaml | ./clone.yaml | The pgstream rules file to compare against | | outputReportJson | ./drift-report.json | Where the JSON drift report is written |

Example:

# Export the current database schema (one row of JSON):
psql "$DATABASE_URL" -t -A -f query.sql -o prod-state.json

# Compare it against clone.yaml:
detect-drift prod-state.json clone.yaml drift-report.json

The query that produces prod-state.json should return a single JSON value shaped like:

[
  { "table_name": "User", "columns": ["id", "email"] },
  { "table_name": "Team", "columns": ["id", "name"] }
]

Exit codes

| Code | Meaning | | --- | --- | | 0 | No drift — the database and clone.yaml match | | 1 | Drift detected, or an error occurred (bad input, unsupported platform, …) |

When drift is detected, a human-readable summary is printed to stderr and a full machine-readable report is written to the output file.

Report format

{
  "generatedAt": "2026-06-29T09:42:33.226Z",
  "jsonFile": "prod-state.json",
  "yamlFile": "clone.yaml",
  "outputFile": "drift-report.json",
  "missingTablesInYaml": ["SentEmail"],
  "missingColumnsInYaml": { "JobAd": ["axaId"] },
  "missingTablesInJson": ["_SimilarJobAdGroupTags"],
  "missingColumnsInJson": { "Team": ["shouldPopulateCompanyInfo"] },
  "hasDrift": true
}
  • missingTablesInYaml / missingColumnsInYaml — present in the database but absent from clone.yaml.
  • missingTablesInJson / missingColumnsInJson — present in clone.yaml but absent from the database.

Supported platforms

Prebuilt binaries are published for:

  • linux-x64, linux-arm64
  • darwin-x64, darwin-arm64

The launcher resolves xata-drift-detection-<os>-<cpu> (installed via optionalDependencies) at runtime, so only the binary matching your platform is downloaded.

License

UNLICENSED