# schema

> Turns Postgres, MySQL, SQLite or Rails schema files into interactive ER diagrams with git-aware visual diffs of migrations.

schema is an open-source tool by Deyan Dobrinov that reads a committed `structure.sql`, MySQL dump, SQLite schema or Rails `schema.rb` and renders it as an interactive entity-relationship diagram. It also shows how the schema changed between git refs as a visual diff. A single Rust engine compiled to WebAssembly powers the CLI, the browser viewer and embeddable HTML diagrams. The latest release listed is v0.7.0.

## What It Is

schema is a command-line tool that starts a local viewer for the schema file in your repository. Run `schema` in a repo and it opens a diagram of `db/structure.sql` or `db/schema.rb`, showing uncommitted changes if any. It needs no database connection, app boot or account, and the README states that schemas are parsed and laid out locally.

## Git-aware schema diffs

You can compare the working tree, the index, commits, branches or tags using git ref syntax such as `main...feature`, or compare two files with `--base-file`. Added tables and columns are shown in green, removed ones in red and dashed, and changed ones in amber with `old → new` types. Comparisons open on the changed tables only, and neighbours can be added. Enum changes appear as nodes linked to the columns that use them. `schema diff` outputs a Markdown or JSON summary for pull requests.

## Focusing and exporting

Large schemas can be narrowed with focus tables and neighbour depth, include/exclude globs, hidden columns, column modes and custom groups. Layouts include layered, force-directed, grid, circular and radial, with orthogonal, curved or straight edges. Named views can be saved in `.schema.json`. Output can be exported as SVG, PNG or a self-contained HTML file, and an embed script mounts diagrams in any page.

## Design mode and agent skills

Design mode lets you sketch new tables, columns, foreign keys and indexes on top of the real schema, view them as a diff, and export a spec that an agent implements as migrations; `schema design check` verifies the result. Bundled skills for Claude Code and other agents (`/schema-view`, `/schema-diff`, `/schema-inspect`, `/schema-embed`, `/schema-design`) open diagrams, review migrations for risks, answer schema questions and generate HTML docs.

## Setup path

Install with Homebrew, download binaries for macOS, Linux or Windows from the releases page, or build from source with Rust and wasm-pack. Git must be on the PATH for git-related features. A browser playground lets you try it without installing.

## Features
- Interactive ER diagrams from structure.sql, schema.rb, MySQL dumps and SQLite schemas
- Git-aware visual diffs between refs, commits, branches or files
- Focus, neighbour depth and glob include/exclude filtering
- Five layouts and three edge styles
- Enum change visualization
- Export to SVG, PNG and self-contained HTML
- Embeddable diagram script
- Design mode with exportable migration spec and design check
- Markdown and JSON schema diff and inspect commands
- Bundled skills for Claude Code and other agents
- In-viewer bug report recorder
- Runs locally with no database connection

## Integrations
Git, Claude Code, Homebrew, Rails, PostgreSQL, MySQL, SQLite

## Platforms
WINDOWS, MACOS, LINUX, WEB, API, CLI

## Pricing
Open Source

## Version
0.7.0

## Links
- Website: https://dobrinov.github.io/schema/
- Documentation: https://github.com/dobrinov/schema#readme
- Repository: https://github.com/dobrinov/schema
- EveryDev.ai: https://www.everydev.ai/tools/schema
