sql-migrate
sql-migrate is a Go-based database schema migration tool that supports multiple databases (SQLite, PostgreSQL, MySQL, MSSQL, Oracle) through both CLI and library interfaces. It allows embedding migrations into applications and supports atomic up/down migrations for rollback capability.
Key facts
Objective fields from the source. Values we can't verify are shown as “Unknown” rather than guessed.
| Field | Value |
|---|---|
| Repository | rubenv/sql-migrate |
| Owner | rubenv |
| Primary language | Go |
| License | MIT — OSI-approved |
| Stars | 3.4k |
| Forks | 292 |
| Open issues | 97 |
| Latest release | Unknown |
| Last updated | 2026-06-04 |
| Source | https://github.com/rubenv/sql-migrate |
What sql-migrate is
Built on gorp and goose, sql-migrate provides SQL-defined migrations with special comment markers (-- +migrate Up/Down) parsed from files or memory sources. It tracks applied migrations in a database table and supports environment-specific configs with variable expansion for credentials.
Get the sql-migrate source
Clone the repository and explore it locally.
git clone https://github.com/rubenv/sql-migrate.gitcd sql-migrate# follow the project's README for install & configurationNeed it deployed, integrated, or customized instead? DEV.co ships production installs.
Best use cases
Implementation considerations
- Migrations are raw SQL; no ORM abstraction, so database-specific syntax (e.g., MySQL parseTime flag, Oracle client setup) must be handled per dialect.
- Migration ordering depends on timestamp-prefixed filenames; naming discipline and review process are critical to avoid out-of-order or conflicting changes.
- The migrations tracking table (default gorp_migrations) must be writable and accessible; permissions and schema ownership should be verified in production.
- Atomic per-migration transactions depend on database support; test rollback behavior under failure conditions before production deployment.
- Environment variable substitution in datasource config (${VAR}) is supported; ensure secrets are never logged or committed to version control.
When to avoid it — and what to weigh
- Non-Go Technology Stack — Projects in Python, Node.js, Java, or other languages should use ecosystem-native tools (Alembic, Flyway, Liquibase) rather than wrapping a Go binary.
- Complex Cross-Database Compatibility — If migrations must run identically across databases with dialect-specific syntax, managing separate SQL files per dialect adds friction; unified abstraction tools may be preferable.
- Stateful Rollback with Data Loss Risk — Down migrations that destructively drop tables or columns require careful testing; if downtime and data recovery procedures are not established, safer tools with dry-run validation are better.
- Team Lacking SQL/Go Expertise — Teams unfamiliar with raw SQL or Go toolchain may struggle with migration authoring, debugging, and CI/CD integration without dedicated expertise.
License & commercial use
Released under the MIT License, a permissive OSI-approved license permitting commercial use, modification, and distribution with minimal restrictions.
MIT license permits commercial use without restriction. No proprietary clauses, GPL-like copyleft, or commercial licensing model detected. Standard commercial software development use is supported.
DEV.co evaluation signals
Editorial assessment — not user reviews. Directional, with an explicit confidence level.
| Signal | Assessment |
|---|---|
| Maintenance | Moderate |
| Documentation | Adequate |
| License clarity | Clear |
| Deployment complexity | Low |
| DEV.co fit | Good |
| Assessment confidence | Medium |
Credentials can be passed via environment variables in datasource config, reducing hardcoding risk. No disclosure of security audit, vulnerability reporting process, or known CVEs in the provided data. Migration files contain raw SQL; injection risk depends on external input validation (not sql-migrate's responsibility). Test environment variable expansion and credential masking in logs.
Alternatives to consider
Flyway (Java, multi-language CLI)
Industry-standard with broader database support, commercial backing, and cloud integrations; better for polyglot teams or enterprises requiring vendor support.
Liquibase (Java, XML/YAML/SQL)
Offers change-log-based versioning, rollback simulation, and drift detection; steeper learning curve but more feature-rich for complex schemas.
goose (Pure Go, simpler syntax)
Similar scope to sql-migrate but earlier project (sql-migrate is based on it); consider if you prefer different API or community activity.
Build on sql-migrate with DEV.co software developers
Assess whether sql-migrate fits your schema management workflow. Review the GitHub repo, run test integrations, and validate multi-database support before adopting in production.
Talk to DEV.coRelated open-source tools
Surfaced by semantic similarity across the DEV.co open-source index.
Related on DEV.co
Explore the category and the services that help you build with it.
sql-migrate FAQ
Can I use sql-migrate to migrate multiple databases in parallel?
What happens if a migration fails partway through?
How do I handle data migrations (not just schema)?
Can I embed migrations in a Docker image or Go binary?
Software development & web development with DEV.co
From first prototype to production, DEV.co delivers software development services around tools like sql-migrate. Our software development agency staffs experienced software developers and web developers for custom software development, web development, integrations, and ongoing support across open-source databases and beyond.
Evaluate sql-migrate for your Go project
Assess whether sql-migrate fits your schema management workflow. Review the GitHub repo, run test integrations, and validate multi-database support before adopting in production.