Skip to content
Search

Sqldef

lastmod 2026-02-12created 2026-02-121 edits

Idempotent schema management tool for MySQL, PostgreSQL, and SQLite

About

  • A CLI-based tool that manages database migrations by comparing the differences (diff) between SQL schemas
  • Lets you manage RDBMS schemas using ordinary SQL DDL syntax
  • Supports major databases such as MySQL, MariaDB, TiDB, PostgreSQL, SQL Server, and SQLite3
  • The website offers an online demo built on a WebAssembly build where you can try schema comparison and DDL generation
  • Database changes can be managed idempotently, which is useful for reliable schema synchronization

sqldef overview

  • sqldef is a CLI tool that compares (diffs) two SQL schemas, analyzes the differences, and generates DDL statements based on them
    • Users can automatically derive the required changes by comparing the current schema with the desired schema
    • Migrations can be performed using ordinary SQL DDL syntax as is
  • Supported databases are listed as MySQL, MariaDB, TiDB, PostgreSQL, SQL Server, and SQLite3

Online demo

  • The website provides an Online Demo for visually checking schema changes
    • The “Enable DROP” option controls whether drop statements are included
    • The “Up (current → desired)” section shows example DDL such as adding new columns, creating indexes, and adding constraints
    • The “Down (desired → current)” section provides examples of reverse changes such as dropping constraints

How it works

  • The online demo uses sqldef's WebAssembly build to perform SQL schema comparison (diff) in the browser
    • Computes the differences between two schemas and automatically generates the required DDL statements from the result
    • The WebAssembly build source can be found via the GitHub repository link

See also

Favorite site

author Zer0 sitemap