qmetrics.net

sqldef

Idempotent SQL schema management CLI

sqldef screenshot

Command-line tools compare desired SQL DDL files to live databases and apply migrations for MySQL, PostgreSQL, SQLite, and SQL Server.

Overview

sqldef manages relational database schemas declaratively using plain SQL DDL files. You keep one file describing the target schema; the tool diffs it against the current database—or against another SQL file in offline mode—and emits the ALTER statements needed to converge state. Operations are idempotent, so repeated runs make no further changes once the database matches the file.

Each supported engine has its own binary (mysqldef, psqldef, sqlite3def, mssqldef) with connection flags modeled on the native client tools. Teams export the live schema, edit the SQL file, preview pending DDL with a dry run, then apply changes in deployment pipelines or locally. Renames of tables, columns, indexes, or enum values can be expressed with @renamed annotations so the generator emits RENAME instead of drop-and-create.

Distribution is a single executable per database with no runtime dependencies, plus Docker images and a Homebrew tap on macOS. Pre-built binaries cover common platforms. A GitHub Action can preview schema diffs in pull requests, and the project website offers a browser demo powered by WebAssembly builds of the diff engine.

The workflow is inspired by Ridgepole’s Ruby DSL approach but keeps everything in standard SQL, which reduces the number of languages operators must remember when maintaining infrastructure code.

Key features

  • Declarative SQL schema files
  • mysqldef, psqldef, sqlite3def, mssqldef
  • Preview mode before applying DDL
  • Offline diff between SQL files
  • @renamed annotations for renames
  • Single-binary distribution
  • Docker images per engine
  • GitHub Action schema previews

Use cases

  • Version-controlled database schemas
  • CI/CD migration previews
  • MySQL and MariaDB schema updates
  • PostgreSQL and SQL Server drift repair
  • Generating migration scripts offline

Tags

Similar software

goose

Database migration tool with SQL and Go migrations

Goose applies incremental SQL or Go migrations across Postgres, MySQL, SQLite, and several other databases. It ships as a command-line tool and as a Go library.

★ 11.8k⟳ 2 days agoMIT
Build & DeploymentDesktop/CLI app

Supabase

Open-source Postgres platform with auth, APIs, and storage

Supabase bundles a dedicated Postgres database with authentication, auto-generated REST and GraphQL APIs, realtime, functions, file storage, and vector tooling.

★ 115.6k⟳ todayApache-2.0
Open Source Alternative to:FirebaseFirebase Realtime Database

nvm

POSIX shell version manager for Node.js

nvm installs and switches between Node.js versions from the command line on POSIX shells including bash and zsh.

★ 96.3k⟳ 2 days agoMIT
Build & DeploymentDesktop/CLI app

uv

Fast Python package and project manager

uv is a Rust-based tool that manages Python dependencies, virtual environments, scripts, and interpreters. It offers a pip-compatible interface and universal lockfiles for projects.

★ 92.7k⟳ 2 days agoApache-2.0
Build & DeploymentDesktop/CLI app

Hugo

Go-based static site generator with flexible templating

Hugo is a static site generator written in Go. It turns content and templates into deployable HTML sites with asset pipelines for CSS, JavaScript, Sass, and images.

★ 90.6k⟳ todayApache-2.0
Build & DeploymentDesktop/CLI app

Vite

Frontend build tool for modern web projects

Vite is a build tool for modern web projects, combining a development server with an optimized production build. It targets a faster, leaner local development workflow.

★ 84.2k⟳ yesterdayMIT
Build & DeploymentDesktop/CLI app