Migo is a lightweight, fast, and easy-to-use migration tool designed to make your database schema changes a breeze. Think of Migo as your trusty cat companionβalways quick, efficient, and here to help you focus on the important stuff: your code. π
Migo was created to make database migrations simple and efficient. Whether you're adding new tables or making schema adjustments, Migo helps you manage changes with ease, so you donβt get bogged down with complicated tools.
- Lightweight and fastβno unnecessary bloat!
- Easy to useβno steep learning curve!
- Create migration files with timestamped names.
- Automatically apply pending migrations.
- Rollback the most recent migration in a flash!
- Initialize Project
- Create Migration
- Apply Migrations
- Rollback Last Migration
- List Migrations
- Prebuilt Binary for Easy Installation
- Build from Source
- Makefile for Common Tasks
- Add CI/CD integration for automated builds and releases
- Create easy installer for multiple platforms (Windows, Linux, macOS)
- Add support for multiple databases (PostgreSQL, MySQL, SQLite, etc.)
- Add support for custom migration templates
Itβs quick and easy to get started with Migoβjust follow the steps below to install and set up your project!
Start by cloning the repo and navigating into the project directory:
git clone https://github.com/wesleybertipaglia/migo.git
cd migoMigo offers two installation options:
No need to worry about Go or complex setupsβjust install the prebuilt binary and get to work!
Prerequisites:
- No Go required! Migoβs binary works out of the box.
makeshould be available on your system (itβs preinstalled on most UNIX-like systems).
To install the prebuilt binary, run:
make installThis installs Migo for your systemβno fuss, no compilation! π₯³
Want to compile Migo yourself? Follow these steps:
Prerequisites:
- Go 1.23 or higher installed.
makeavailable.
To build and install Migo from source:
make build
make installThis will build Migo locally and install it to
/usr/local/binor any directory in yourPATH. βοΈ
Creating your migration project is super easy. Just run:
migo initThis creates a neat folder structure for your migrations:
migo/
βββ migrations/
βββ logs/
βββ state/
βββ migo.db
You can even specify a custom project directory:
migo init --project ./backendAdding a new migration? Migo makes it a snap:
migo add --name create_users_tableThis will create a migration file like:
migo/migrations/20250507123456_create_users_table.sql
With placeholders for your SQL:
-- Migration: create_users_table
-- Created at: 2025-05-07T12:34:56
-- UP
-- DOWNGot some pending migrations? Apply them in one swift move:
migo updateMade a mistake? No worries, just roll back the last migration:
migo rollbackHere are the available commands in Migo:
migo init: Initializes the migration project with the necessary folder structure.migo add --name <migration_name>: Creates a new migration file with the specified name. The name is appended to the timestamp to ensure a unique file.migo update: Applies all pending migrations to the database.migo rollback: Rolls back the last applied migration.migo list: Lists all migrations along with their status (either "Applied" or "Pending").
Handy makefile commands are included for building, installing, cleaning, and more:
make build # Build the binary
make install # Install the binary globally
make clean # Clean up (goodbye, binary!)
make dev # Run the project with `go run main.go`
make fmt # Format the code
make lint # Lint the codeMigo is open-source and weβd love to have your help! If youβve got ideas, suggestions, or want to fix a bug, feel free to open an issue or submit a pull request. Together, we can make Migo even better! π‘
This project is licensed under the MIT License. See the LICENSE file for more details. π