A lightweight, framework-agnostic command-line tool for managing plain SQL database migrations across teams and environments.
pressly/goose
A CLI and Go library for managing database schema changes through versioned SQL files or Go functions.
- Stars
- 11,599
- Forks
- 719
- Open issues
- 145
- Last commit
- 3 days ago
What is it?
Goose is a database migration tool that can be used as a command-line program or imported as a Go library. It manages schema changes as incremental migrations, each of which can be applied going up or rolled back going down, and tracks which versions have been applied in the database.
Migrations can be written as plain SQL files with up and down annotations, or as Go functions registered in your own binary. It supports a range of databases including Postgres, MySQL, MariaDB, SQLite, Spanner, ClickHouse, MSSQL and Vertica, and migration files can be embedded into a Go binary with the embed package. Other features include out-of-order migration handling, environment variable substitution in SQL files, and a fix command that converts timestamped migrations into sequential order for production.
Unused drivers can be excluded at build time with build tags to produce a smaller binary.
Key features
- 01Runs SQL migrations and Go function migrations.
- 02Supports Postgres, MySQL, MariaDB, SQLite, Spanner, ClickHouse, MSSQL and more.
- 03Embeds migration files into Go binaries via embed.FS.
- 04Supports out-of-order migrations and a fix command for sequential numbering.
- 05Substitutes environment variables inside SQL migrations.
Use cases
- Versioning the schema of a Go backend that runs against Postgres or MySQL.
- Shipping database migrations inside a single deployable binary.
- Running schema changes in CI so migrations are applied consistently across environments.
Quick start
- 1
Install the goose CLI with Go
go install github.com/pressly/goose/v3/cmd/goose@latest - 2
Check migration status against a SQLite database
goose sqlite3 ./foo.db status - 3
Apply all available migrations
goose sqlite3 ./foo.db up
Things to know
- The README states the CLI needs a database driver and connection string for each command, so you must supply your own database.
- Go is required to install the CLI via go install; Homebrew is offered only for macOS users.
Topics
FAQ
- What is goose?
- A CLI and Go library for managing database schema changes through versioned SQL files or Go functions. Goose is a database migration tool that can be used as a command-line program or imported as a Go library. It manages schema changes as incremental migrations, each of which can be applied going up or rolled back going down, and tracks which versions have been applied in the database.
- Is goose free to use? What license does it have?
- goose is open source under the Other license. Check the license terms before using it in commercial products.
- Is goose still maintained?
- Actively maintained. The last commit to goose was on Oct 17, 2026.
- What can I use goose for?
- Versioning the schema of a Go backend that runs against Postgres or MySQL. Shipping database migrations inside a single deployable binary. Running schema changes in CI so migrations are applied consistently across environments.
- How do I install goose?
- Install the goose CLI with Go: go install github.com/pressly/goose/v3/cmd/goose@latest Check migration status against a SQLite database: goose sqlite3 ./foo.db status Apply all available migrations: goose sqlite3 ./foo.db up
- Where can I get goose?
- The source code and installation instructions are on GitHub: https://github.com/pressly/goose
Summary generated by AI from the project's README. GitHub stats refresh daily.
Related projects
A lightweight, headless TypeScript ORM for PostgreSQL, MySQL and SQLite that works across Node.js, Bun, Deno and edge runtimes.
Cross-platform SQL editor and database manager for Linux, macOS, and Windows, supporting MySQL, PostgreSQL, SQLite, SQL Server and many more.
Full-stack database exploration tool for designing, navigating, documenting and analyzing schemas, with ERD diagrams for large, messy databases.
AI-powered database client and MCP server for desktop and web, supporting Postgres, MySQL, MariaDB, SQL Server, ClickHouse and SQLite.
Free multi-platform desktop SQL client and database tool supporting 100+ databases via JDBC and ODBC drivers.