A database migration tool. Supports SQL migrations and Go functions.
Goose is a database migration tool. Both a CLI and a library.
Manage your database schema by creating incremental SQL changes or Go functions.
Features
- Works against multiple databases:
- Postgres, MySQL, SQLite, YDB, ClickHouse, MSSQL, Vertica, and more.
- Supports Go migrations written as plain functions.
- Supports embedded migrations.
- Out-of-order migrations.
- Seeding data.
- Environment variable substitution in SQL migrations.
- ... and more.
CLI: azuresql driver for Azure SQL with Microsoft Entra ID (Azure AD) authentication via
fedauth connection string parameters, e.g.
goose azuresql "sqlserver://host?database=mydb&fedauth=ActiveDirectoryDefault" status.
Excluded when building with the no_mssql or no_azuresql tags (#1109)
MySQL/MariaDB table-based Locker via lock.NewMySQLTableLocker, the MySQL counterpart to the
Postgres table locker from #993, accepting the same TableLockerOption set (#1075)
Changed
Minimum Go version is now 1.26
ClickHouse: new goose_db_version tables are created with ORDER BY (version_id) instead of
ORDER BY (date). Existing tables are unchanged (#1085)
MySQL/TiDB: the tstamp column is now DATETIME instead of TIMESTAMP, which is capped at
2038-01-19 (#1053). Only newly created tables are affected; existing tables can be updated with:
ALTER TABLE goose_db_version MODIFY tstamp datetime NULL DEFAULT CURRENT_TIMESTAMP;
Various dependency upgrades
Fixed
goose create returns a clear "file exists" error, including the path, instead of %!w()
when the migration file already exists (#1104)
Original work Copyright (c) 2012 Liam Staskawicz
Modified work Copyright (c) 2016 Vojtech Vitek
Modified work Copyright (c) 2021 Michael Fridman, Vojtech Vitek