go-migration

A Laravel-inspired database migration and seeding system for Go. Define migrations as structs, build schemas fluently, and seed data with factories.

$go get github.com/andrianprasetya/go-migration
Get Started

Everything you need for database migrations in Go

📦

Struct-Based Migrations

Define migrations as Go structs with Up and Down methods. Type-safe, version-controlled, and easy to reason about.

🔧

Fluent Schema Builder

Build tables, columns, indexes, and foreign keys with a chainable API. No raw SQL required.

🌱

Seeders & Factories

Populate your database with test data using seeders with dependency resolution and generic factories with faker support.

⌨️

CLI Commands

Manage migrations from the terminal — migrate, rollback, reset, refresh, fresh, status, and scaffolding commands.

🗄️

Multi-Database Support

Works with PostgreSQL, MySQL, and SQLite. Manage multiple named connections with configurable pooling.

🔌

Framework Agnostic

Depends only on *sql.DB — use it with Gin, Echo, Fiber, net/http, or any Go application.