Idempotent schema management tool for MySQL, PostgreSQL, SQLite, and SQL Server using plain SQL DDLs.
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.
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.
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.
Idempotent schema management for MySQL, PostgreSQL, SQLite, and SQL Server
Open-Awesome is built by the community, for the community. Submit a project, suggest an awesome list, or help improve the catalog on GitHub.
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.
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.
Provides dedicated commands (mysqldef, psqldef, etc.) for MySQL, PostgreSQL, SQLite, and SQL Server with consistent workflows, mimicking native client options for familiarity.
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.
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.
Focuses on state-based migrations without built-in tracking of applied changes or rollback mechanisms, limiting auditability compared to versioned migration tools.
While supporting multiple databases, certain advanced features may not be uniformly implemented, as indicated by separate command documentation for each database.