Managing database schemas across development, staging, and production environments is one of the most persistent challenges in modern software engineering. Schema drift, manual SQL changes, and inconsistent migration practices lead to deployment failures, data loss, and hours of debugging. This guide compares three self-hosted, open-source tools that solve this problem with fundamentally different approaches: Atlas, sqldef, and Skeema.
The Database Schema Problem
Every database-driven application needs a reliable way to evolve its schema over time. Traditional migration tools use imperative approaches — you write “up” and “down” SQL scripts and trust that running them in order produces the desired state. This works for small teams but breaks down as databases grow: scripts drift from reality, rollbacks become unreliable, and coordinating changes across multiple databases becomes error-prone.
Declarative schema management tools take a different approach. You define the desired schema state, and the tool calculates the diff between your definition and the live database, generating the necessary migration SQL automatically. This eliminates script drift, makes rollbacks predictable, and enables schema-as-code workflows that integrate cleanly with CI/CD pipelines.
For broader database schema comparison and migration frameworks, see our database schema diff guide and zero-downtime MySQL schema migration comparison.
Atlas (Ariga)
Atlas by Ariga is a modern, database-agnostic schema management tool that supports MySQL, PostgreSQL, SQLite, MariaDB, and SQL Server. It uses a declarative “schema-as-code” approach with its own HCL-based schema definition language (HCL), and also supports loading schemas from existing databases or ORM frameworks like Prisma, Ent, and GORM.
Key Features:
- Declarative HCL schema definition — write schemas in a concise, database-agnostic HCL format
schema applyandschema diff— apply changes directly or preview the generated SQL- Migration directory — version-controlled migration files with hash-based integrity checking
- Multi-database support — MySQL, PostgreSQL, SQLite, MariaDB, SQL Server
- ORM integration — automatically load schemas from Prisma, Ent, GORM, and SQLAlchemy
- Cloud integration — optional Atlas Cloud for team collaboration and CI/CD
Installation via Docker:
| |
Example HCL schema:
| |
Apply schema to live database:
| |
The --dev-url flag uses a temporary Docker container to safely plan migrations without connecting to your production database.
sqldef
sqldef is a lightweight, open-source schema management tool written in Go. It supports MySQL, PostgreSQL, SQLite, SQL Server, and even Redis (for key schema). Unlike Atlas, sqldef uses raw SQL DDL as its source of truth — you write standard CREATE TABLE and ALTER TABLE statements, and sqldef compares them against the live database.
Key Features:
- SQL-first — use standard SQL DDL as your schema definition, no new DSL to learn
- Lightweight binary — single Go binary with zero dependencies, ~15MB
- Dry-run mode — preview the generated SQL without applying changes
- Export mode — dump existing database schema as SQL DDL
- Multi-database support — MySQL, PostgreSQL, SQLite, SQL Server, Redis
- CI/CD friendly — simple CLI, easy to integrate into pipelines
Installation:
| |
Define your schema in a SQL file:
| |
Apply the schema:
| |
sqldef’s approach is elegantly simple: write standard SQL, let the tool figure out the diff. There’s no migration directory, no version tracking — just the desired state and the live database.
Skeema
Skeema is a declarative, pure-SQL schema management tool built specifically for MySQL and MariaDB. Unlike Atlas and sqldef, Skeema is designed for enterprise-scale database operations with complex sharding, multiple environments, and strict governance requirements.
Key Features:
- Pure SQL — schema files are plain
.sqlfiles, no custom DSL - Directory-based organization — one directory per database, one file per table
- Flavor support — MySQL 5.7+, MySQL 8.0+, MariaDB 10.x
- Workspace management — diff across multiple environments simultaneously
- CI/CD integration — lint, format, and validate schemas in pipelines
- Sharding support — manage schemas across multiple MySQL instances
- Safe ALTER support — online DDL with pt-online-schema-change and gh-ost integration
Installation via Docker:
| |
Directory structure after init:
| |
Each .sql file contains standard DDL:
| |
Diff and apply:
| |
Skeema’s .skeema configuration file stores connection details per environment, making it easy to manage dev, staging, and production schemas from the same directory tree.
Comparison Table
| Feature | Atlas | sqldef | Skeema |
|---|---|---|---|
| License | Apache 2.0 (core) | MIT | Apache 2.0 |
| Database Support | MySQL, PostgreSQL, SQLite, MariaDB, SQL Server | MySQL, PostgreSQL, SQLite, SQL Server, Redis | MySQL, MariaDB only |
| Schema Format | HCL (custom DSL) | Raw SQL DDL | Raw SQL DDL |
| Migration Tracking | Versioned migration directory | None (desired state only) | None (desired state only) |
| ORM Integration | Prisma, Ent, GORM, SQLAlchemy | None | None |
| Docker Image | arigaio/atlas | Binary download | skeema/skeema |
| Stars (GitHub) | 8,400+ | 3,000+ | 1,300+ |
| Online DDL | Via dev URL planning | None built-in | pt-osc and gh-ost integration |
| Multi-Environment | Via separate HCL files | Manual per-environment | Built-in workspace support |
| CI/CD Linting | atlas schema lint | None | skeema lint |
| Best For | Teams wanting schema-as-code + ORM integration | Developers who prefer raw SQL | Enterprise MySQL/MariaDB ops |
Choosing the Right Tool
Choose Atlas if:
- You work with multiple database types (MySQL, PostgreSQL, SQLite)
- Your team uses ORMs (Prisma, Ent, GORM) and wants schema sync
- You want versioned migration directories with integrity checking
- You need a modern, actively developed tool with cloud integration
Choose sqldef if:
- You want the simplest possible workflow — just SQL files
- You prefer lightweight tools with zero dependencies
- Your team knows SQL and doesn’t want to learn a new DSL
- You need quick schema diffs in CI/CD pipelines
Choose Skeema if:
- You run MySQL or MariaDB at scale (sharding, multiple environments)
- You need enterprise features like workspace management and linting
- Your team uses online DDL (pt-osc, gh-ost) for zero-downtime migrations
- You want directory-per-table organization for large schemas
Docker Compose Deployment
Here’s a complete Docker Compose setup for testing all three tools:
| |
Why Self-Host Schema Management Tools?
Database schema management is a critical part of any software delivery pipeline. Using cloud-hosted or SaaS schema management tools introduces several risks:
Data sovereignty and compliance: Your schema definitions contain sensitive information about your data model, including table names, column types, and relationships. For organizations subject to GDPR, HIPAA, or SOC 2 compliance, keeping schema management on-premises ensures that this metadata never leaves your infrastructure.
CI/CD pipeline integration: Self-hosted schema tools integrate directly into your existing CI/CD pipelines without requiring API tokens, network access to external services, or vendor-specific authentication. This makes schema validation a native part of your build process rather than an external dependency.
Cost and vendor lock-in: Open-source schema management tools are free to use and modify. You’re not locked into a vendor’s pricing model or feature roadmap. If a tool doesn’t meet your needs, you can fork it, contribute upstream, or switch to an alternative without data migration overhead.
Offline and air-gapped environments: Many enterprise environments operate in air-gapped or restricted network zones. Self-hosted schema tools work entirely offline once installed, making them suitable for environments where external API calls are prohibited.
For database query routing strategies that complement schema management, see our database query routing guide. For PostgreSQL-specific high-availability patterns, check our PostgreSQL operators guide.
FAQ
What is declarative database schema management?
Declarative schema management means you define the desired end state of your database schema (tables, columns, indexes, constraints), and the tool automatically calculates the SQL changes needed to get from the current state to the desired state. This contrasts with imperative migration tools where you manually write each ALTER TABLE statement.
Can Atlas manage schemas for multiple database types?
Yes. Atlas supports MySQL, PostgreSQL, SQLite, MariaDB, and SQL Server through a unified HCL schema definition language. It also integrates with ORM frameworks (Prisma, Ent, GORM, SQLAlchemy) to automatically load and manage schemas from application code.
Does sqldef track migration versions?
No. sqldef operates purely on desired-state comparison. You write the complete current schema in a SQL file, and sqldef compares it against the live database to determine what changes are needed. There’s no version history or migration directory — this is by design for simplicity.
Is Skeema suitable for PostgreSQL?
No. Skeema is purpose-built for MySQL and MariaDB only. It leverages MySQL-specific features like the INFORMATION_SCHEMA structure, MySQL’s online DDL capabilities, and integration with pt-online-schema-change and gh-ost. For PostgreSQL schema management, consider Atlas or sqldef.
How do these tools handle production deployments?
Atlas uses a “dev URL” approach — it spins up a temporary Docker container to safely plan migrations without connecting to production. sqldef offers a --dry-run flag to preview changes before applying. Skeema supports integration with pt-online-schema-change and gh-ost for zero-downtime schema changes on large MySQL tables.
Can I use these tools in a CI/CD pipeline?
All three tools are designed for CI/CD integration. Atlas provides atlas schema lint and atlas schema diff commands for pipeline validation. sqldef is a single binary with simple CLI flags. Skeema includes skeema lint, skeema format, and skeema diff for automated schema checks in build pipelines.