v1.0.0 • Production Ready

Database migrations in Go, done right.

Struct-based migrations, a fluent schema builder, seeders, factories, and a single-binary CLI — all framework-agnostic. Ship confident schema changes across PostgreSQL, MySQL, and SQLite.

MIT LicensedZero runtime depsSingle binary CLI
migrations/001_create_users.go
package migrations

type CreateUsers struct{}

func (m *CreateUsers) Up(s *schema.Builder) {
    s.Create("users", func(t *schema.Table) {
        t.ID()
        t.String("email").Unique()
        t.String("name").Nullable()
        t.Timestamps()
    })
}
QUICK START

From zero to your first migration in 60 seconds

Install the CLI, scaffold a migration, and run it. That's it.

1Install

Install the CLI with a single go install command.

bash
go install github.com/gopackx/go-migration@latest
 
2Scaffold

Generate a migration file with a sensible template.

bash
go-migration make:migration create_users_table
 
3Migrate

Apply pending migrations to your database.

bash
go-migration migrate
  ✔ 001_create_users_table
Ready for more?Explore the full docs for factories, seeders, rollbacks, and advanced patterns.
Read the docs
WHY GO-MIGRATION

A modern take on Go database migrations

See how go-migration compares to the most popular alternatives in the Go ecosystem.

Featurego-migrationgolang-migrategoose
Struct-based migration APIPartial
Fluent schema builder (no raw SQL)
Built-in seeders with dependency resolution
Generic factories with faker support
Transactional migrations with auto-rollback
Database drivers supportedPG · MySQL · SQLite10+ drivers6+ drivers
Framework agnostic (works with any *sql.DB)
CLI with migrate, rollback, fresh, scaffoldPartial
Comparison based on publicly documented features as of April 2026. Missing something? Open a PR.Read the full comparison
OPEN SOURCE · MIT LICENSE

Ready to ship faster migrations?

Join thousands of Go developers managing their database schemas with confidence. Read the docs, explore examples, or drop a star on GitHub.