Releases: pressly/goose
v3.18.0
v3.18.0
(current release) the minimum supported Go version is go1.20
New features
-
Add environment variable substitution for SQL migrations. (#604)
-
This feature is disabled by default, and can be enabled by adding an annotation to the
migration file:-- +goose ENVSUB ON
-
When enabled, goose will attempt to substitute environment variables in the SQL migration
queries until the end of the file, or until the annotation-- +goose ENVSUB OFF
is found. For
example, if the environment variableREGION
is set tous_east_1
, the following SQL migration
will be substituted toSELECT * FROM regions WHERE name = 'us_east_1';
-- +goose ENVSUB ON -- +goose Up SELECT * FROM regions WHERE name = '${REGION}';
-
This feature intentionally supports a minimal expansion set; see Supported Expansions in the https://github.com/mfridman/interpolate repository (forked from https://github.com/buildkite/interpolate)
-
Fixes
- Fixed query for list migrations in YDB (#684)
v3.17.0
- Standardised the MIT license (#647)
- Improve provider
Apply()
errors, addErrNotApplied
when attempting to rollback a migration
that has not been previously applied. (#660) - Add
WithDisableGlobalRegistry
option toNewProvider
to disable the global registry. (#645) - Add
-timeout
flag to CLI to set the maximum allowed duration for queries to run. Default remains
no timeout. (#627) - Add optional logging in
Provider
whenWithVerbose
option is supplied. (#668)
⚠️ Potential Breaking Change ⚠️
- Update
goose create
to use UTC time instead of local time. (#242)
v3.16.0
- Added YDB support. (#592)
- Fix sqlserver query to ensure DB version. (#601)
- Allow setting / resetting the global Go migration registry. (#602)
SetGlobalMigrations
andResetGlobalMigrations
functions have been added.- Introduce
NewGoMigration
for constructing Go migrations.
- Add initial implementation of
goose.NewProvider
.
🎉 Read more about this new feature here:
https://pressly.github.io/goose/blog/2023/goose-provider/
The motivation behind the Provider was simple - to reduce global state and make goose easier to consume as an imported package.
Here's a quick summary:
- Avoid global state
- Make Provider safe to use concurrently
- Unlock (no pun intended) new features, such as database locking
- Make logging configurable
- Better error handling with proper return values
- Double down on Go migrations
- ... and more!
v3.15.1
- Fix regression that prevented registering Go migrations that didn't have the corresponding files
available in the filesystem. (#588)- If Go migrations have been registered globally, but there are no .go files in the filesystem,
always include them. - If Go migrations have been registered, and there are .go files in the filesystem, only
include those migrations. This was the original motivation behind #553. - If there are .go files in the filesystem but not registered, raise an error. This is to
prevent accidentally adding valid looking Go migration files without explicitly registering
them.
- If Go migrations have been registered globally, but there are no .go files in the filesystem,
v3.15.0
v3.14.0
- Filter registered Go migrations from the global map with corresponding .go files from the
filesystem.- The code previously assumed all .go migrations would be in the same folder, so this should not
be a breaking change. - See #553 for more details
- The code previously assumed all .go migrations would be in the same folder, so this should not
- Improve output log message for applied up migrations. #562
- Fix an issue where
AddMigrationNoTxContext
was registering the wrong source because it skipped
too many frames. #572 - Improve binary version output when using go install.
v3.13.4
- Fix pre-built binary versioning and make small improvements to GoReleaser config (a tool for packaging / releasing Go tools).
- Fix an edge case in the
sqlparser
where the last up statement may be ignored if it's
unterminated with a semicolon and followed by a-- +goose Down
annotation. - Trim
Logger
interface toPrintf
andFatalf
methods only. Projects that have previously
implemented theLogger
interface should not be affected, and can remove unused methods.
v3.13.3
Fixed a bunch of build issues, see https://github.com/pressly/goose/releases/tag/v3.13.4 for correct changelog.
v3.13.1
- Add pre-built binaries with GoReleaser and update the build process.
Release v3.13.0
Changelog
- Fix
up
andup -allowing-missing
behavior. - Fix empty version in log output.
- Add new
context.Context
-aware functions and methods, for both sql and go migrations. - Return error when no migration files found or dir is not a directory.
Note, tags v3.12.0
, v3.12.1
, v3.12.2
have been retracted because they contained the wrong module reference, please use the current release v3.13.0
onwards. Apologies for the inconvenience.
Full Changelog: v3.11.2...v3.13.0