explaingit

pressly/goose

10,656GoAudience · developerComplexity · 2/5Setup · easy

TLDR

Goose is a database migration tool for Go projects that tracks and runs SQL or Go-based schema changes for Postgres, MySQL, SQLite, and more, with rollback support.

Mindmap

mindmap
  root((goose))
    What it does
      Track migrations
      Apply schema changes
      Roll back changes
    Supported databases
      PostgreSQL
      MySQL
      SQLite
      SQL Server
    Migration types
      SQL files
      Go functions
    Key commands
      up and down
      status and create
      up-to and down-to
Click or tap to explore — scroll the page freely

Code map

Detail Auto

An interactive map of this repo's files and how they connect — its source is parsed live in your browser. Click Visualize to build it.

filefunction / class

Things people build with this

USE CASE 1

Manage database schema changes in a Go web app, tracking which migrations have been applied across dev, staging, and production.

USE CASE 2

Roll back a botched database change with a single goose down command.

USE CASE 3

Write migrations as Go functions when plain SQL is not expressive enough for complex data transformations.

USE CASE 4

Sync database schemas across a team where different developers create migrations on different branches.

Tech stack

GoSQLPostgreSQLMySQLSQLiteSQL ServerClickHouse

Getting it running

Difficulty · easy Time to first run · 5min

In plain English

Goose is a tool for managing database migrations, the controlled process of updating or rolling back the structure of a database as a software project evolves. It is written in Go and works as both a command-line program you can run directly and as a library you can import into your own Go code. When a project's database needs a new table, a changed column, or some removed data, developers write migration files that describe those changes in sequence. Goose keeps track of which migrations have already been applied, runs the ones that have not, and can reverse them if needed. Migration files can be written as plain SQL statements or as Go functions, giving teams flexibility in how they express changes. Goose works with many database systems, including Postgres, MySQL, SQLite, SQL Server, ClickHouse, and several others. Installing it takes one command using the standard Go toolchain, and macOS users can also install it through Homebrew. The commands you use most often are: up to apply all pending migrations, down to roll back the most recent one, status to see which migrations have run and which are still pending, and create to generate a new migration file with a timestamp in the name. The tool also offers up-to and down-to for landing at a specific version, and reset to roll back everything at once. A notable feature is support for out-of-order migrations, which means Goose can apply migrations correctly even when different team members created them in different orders across different environments. SQL migration files can also reference environment variables, which is useful when connection strings or schema names differ between development and production.

Copy-paste prompts

Prompt 1
I have a Go app using goose. Write a migration file that adds a users table with id, email, and created_at columns, plus a rollback function.
Prompt 2
Show me how to embed goose migrations in a Go binary and run them programmatically at app startup using the goose library.
Prompt 3
Generate a goose SQL migration that renames a column safely on a large Postgres table with minimal locking.
Prompt 4
Write a goose SQL migration file that reads the connection string from an environment variable for use in CI/CD pipelines.
Open on GitHub → Explain another repo

← pressly on gitmyhub — every repo by this author, as a profile.

Verify against the repo before relying on details.