Open-Awesome
CategoriesAlternativesStacksSelf-HostedExplore
Open-Awesome

© 2026 Open-Awesome. Curated for the developer elite.

TermsPrivacyAboutGitHubRSS
  1. Home
  2. Database Tools
  3. sqldef

sqldef

NOASSERTIONGov3.11.16

Idempotent schema management tool for MySQL, PostgreSQL, SQLite, and SQL Server using plain SQL DDLs.

Visit WebsiteGitHubGitHub
3.1k stars235 forks0 contributors

What is sqldef?

sqldef is a command-line tool for idempotent database schema management across multiple database systems including MySQL, PostgreSQL, SQLite, and SQL Server. It allows developers to define their desired database schema in plain SQL DDLs, and automatically generates and applies the necessary migration scripts to achieve that state from any current schema. The tool ensures operations are safe to run multiple times and eliminates the need to manually write ALTER TABLE statements.

Target Audience

Database administrators, backend engineers, and DevOps practitioners who need to manage and version database schemas across development, staging, and production environments, especially in teams using multiple database technologies.

Value Proposition

Developers choose sqldef because it uses plain SQL—a familiar language—instead of a custom DSL, supports multiple major databases with consistent workflows, provides idempotent operations for safety, and offers a simple single-binary distribution with no dependencies.

Overview

Idempotent schema management for MySQL, PostgreSQL, SQLite, and SQL Server

Use Cases

Best For

  • Managing schema migrations across MySQL, PostgreSQL, SQLite, and SQL Server with a single tool
  • Implementing declarative database schema changes in CI/CD pipelines
  • Generating safe ALTER TABLE statements automatically from SQL definitions
  • Comparing database schemas offline without connecting to a live database
  • Renaming database tables, columns, and indexes with annotation-based migrations
  • Ensuring idempotent schema deployments that can be safely rerun

Not Ideal For

  • Projects requiring data migration (DML) alongside schema changes
  • Teams heavily invested in ORM-specific migration frameworks like Rails ActiveRecord or Django Migrations
  • Databases with extensive use of non-standard features like stored procedures or custom types not fully supported
  • Environments mandating explicit, versioned migration files for audit or compliance purposes

Pros & Cons

Pros

Idempotent Operations

Ensures schema changes are safe to run multiple times by detecting and applying only necessary DDLs, as emphasized in the key features for reliable deployments.

Plain SQL DDLs

Uses standard SQL CREATE/ALTER statements instead of a custom DSL, reducing the learning curve since developers already know SQL, as stated in the philosophy.

Multi-Database Support

Provides dedicated commands (mysqldef, psqldef, etc.) for MySQL, PostgreSQL, SQLite, and SQL Server with consistent workflows, mimicking native client options for familiarity.

Offline Mode

Allows comparing two SQL files without a live database connection, useful for CI/CD pipelines and migration script generation, as detailed in the offline mode section.

Cons

Annotation-Based Renaming

Requires non-standard `@renamed` annotations in SQL comments for renaming tables, columns, or indexes, which can be error-prone and less intuitive than native SQL syntax.

No Migration History

Focuses on state-based migrations without built-in tracking of applied changes or rollback mechanisms, limiting auditability compared to versioned migration tools.

Database Feature Gaps

While supporting multiple databases, certain advanced features may not be uniformly implemented, as indicated by separate command documentation for each database.

Frequently Asked Questions

Quick Stats

Stars3,131
Forks235
Contributors0
Open Issues0
Last commit7 hours ago
CreatedSince 2018

Tags

#mssql#devops#sql-server#ci-cd#database-migrations#postgresql#mariadb#mysql#sqlite#sqlite3#schema-changes#declarative-schema

Built With

G
Go

Links & Resources

Website

Included in

Database Tools5.1k
Auto-fetched 5 hours ago

Related Projects

BytebaseBytebase

World's most advanced database DevSecOps solution for Developer, Security, DBA and Platform Engineering teams. The GitHub/GitLab for database DevSecOps.

Stars14,287
Forks964
Last commit3 hours ago
gh-ostgh-ost

GitHub's Online Schema-migration Tool for MySQL

Stars13,489
Forks1,404
Last commit3 days ago
flywayflyway

Flyway by Redgate • Database Migrations Made Easy.

Stars9,941
Forks1,627
Last commit3 days ago
AtlasAtlas

Declarative schema migrations with schema-as-code workflows

Stars8,601
Forks366
Last commit28 days ago
Community-curated · Updated weekly · 100% open source

Found a gem we're missing?

Open-Awesome is built by the community, for the community. Submit a project, suggest an awesome list, or help improve the catalog on GitHub.

Submit a projectStar on GitHub