Migo is a lightweight, Go-based database migration CLI and library inspired by tools like Laravel's migration system. It helps you version your schema changes, apply migrations, rollback, and manage migration files using a clean, intuitive workflow.
- Define migrations using single-file templates with
[UP]and[DOWN]blocks. - Core commands:
migo make "description"— scaffold a new migration.migo up,migo down,migo refresh,migo fresh— manage migrations.
- Supports flags like
--steps, and--dry-run. - Compatible with multiple SQL dialects (Postgres, MySQL, SQLite, SQL Server).
- Uses GORM under the hood; easy to integrate into your Go project.
- Zero-dependency CLI in a compact binary.
go install github.com/sagar290/migo@latestMake sure $GOPATH/bin (or $GOBIN) is in your PATH.
📥 Quick Download Example (Linux) Releases
curl -L -o migo https://github.com/sagar290/migo/releases/download/<version_number>/migo-darwin-amd64
chmod +x migo
./migo --help
migo make "create drivers table"This generates a timestamped .sql file with UP/DOWN placeholders:
[UP]
-- Write your UP migration here
[/UP]
[DOWN]
-- Write your DOWN migration here
[/DOWN]migo upUse flags:
--steps=2— apply only the next 2 migrations.--dry-run— preview what would run without executing.
migo down- By default rolls back the last batch.
- Use
--steps=1to rollback only one migration. - Supports
--dry-run. - Load custom yaml file like
migo up -f config.yml
migo refreshRolls back and re-applies migrations in one command. Use flags for safety (--dry-run).
migo freshDrops all tables (except migrations history), then re-runs all migrations. Use with caution; supports --dry-run.
Configure migo via migo.yml:
migo:
db_type: postgres
db_url: postgres://username:password@localhost:5432/migoTest
migrations_dir: ./migrations
schema: public
migration_table: migo_migrationsYou can override settings via environment variables or flags when initializing the CLI. The environment variable will looks like this
MIGO_DB_TYPE
MIGO_DB_URL
MIGO_MIGRATION_DIR
- Fork the project and create a feature branch
- Write tests for new features or bugs
- Submit a pull request with a clear explanation


