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

dbml-diff

v1.1.0

Published

Structural diff for DBML schema files - emits text, JSON, an annotated DBML document that renders as a visual diff in dbdiagram.io, D2 diagram source, or a locally-rendered SVG

Readme

dbml-diff

npm version CI license

Structurally diff two DBML schema files and emit the result as text, JSON, an annotated DBML document that renders as a visual diff in dbdiagram.io, or a locally-rendered SVG via D2.

npx dbml-diff old.dbml new.dbml                              # readable text summary
npx dbml-diff old.dbml new.dbml --format dbml -o diff.dbml   # visual diff, paste into dbdiagram.io
npx dbml-diff old.dbml new.dbml --format svg -o diff.svg     # render locally to a self-contained SVG
npx dbml-diff old.dbml new.dbml --migrate -o up.sql          # T-SQL migration script

Why

If you keep your database schema as DBML in version control, git diff between two versions is line-noise: attribute reordering, whitespace, and hundreds of unchanged lines drown the handful of real changes. dbdiagram.io has no built-in version compare, and existing schema-diff tools target live databases, not DBML files. dbml-diff compares the two documents structurally - tables, columns, types, nullability, primary keys, enums - and tells you exactly what changed. Inspired by holistics/dbml#175.

The visual diff shows only what changed - added, removed, and modified tables, with per-column annotations:

Install

npm i -g dbml-diff    # or keep using npx

Usage

dbml-diff <old.dbml> <new.dbml> [options]

The default output is a readable text summary. --format json gives a machine-readable result, and --format dbml gives the annotated document for the visual diff. Diff output goes to stdout (or the -o file); the counts summary goes to stderr, so stdout stays pipeable. Exit codes are 0 (identical), 1 (differences found), and 2 (error), which makes it a drop-in CI gate.

See the CLI reference for the full flag list, output streams, exit codes, and parsing behaviour.

Visual diff

--format dbml emits an annotated DBML document that renders in dbdiagram.io as a diff of only what changed, using NEW · / MOD · / DEL · table prefixes and __ADDED / __REMOVED / __RENAMED / __CHANGED column suffixes.

--format svg renders the same diff locally to a self-contained SVG via D2 - state-coloured table headers, tooltips for change detail, and a grid layout that stays compact where dbdiagram spreads out. It needs the optional @terrastruct/d2 package (npm i @terrastruct/d2); --format d2 emits the D2 source with nothing to install.

See the visual diff guide for every marker, the D2/SVG output, and how to view it in dbdiagram.io.

Migration script

--migrate emits a T-SQL migration script (SQL Server / Azure Synapse) that transforms the old schema into the new one. Additive statements (CREATE, ALTER ... ADD, foreign keys) are emitted live; destructive and heuristic statements (DROP, rename) are commented out, so a straight run is non-destructive. See the migration guide for the full detail and caveats.

Programmatic API

const { diff, emitText, emitJson, emitDbml, emitD2, emitMigration, renderSvg } = require('dbml-diff');

const result = diff(oldDbmlString, newDbmlString);
console.log(emitText(result));

See the API reference for the full diff() return shape and emitter options.

Documentation

Roadmap

Visual public roadmap - what shipped, what's in progress, what's next. Generated from the issue tracker: issues labelled roadmap become cards, status: labels set the column, closed issues land in Done.