Skip to content

Commit 8f0ae05

Browse files
committed
Merge remote-tracking branch 'upstream/main'
2 parents 2828111 + 3480c8c commit 8f0ae05

File tree

114 files changed

+6337
-2319
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

114 files changed

+6337
-2319
lines changed

.github/workflows/ci.yaml

Lines changed: 17 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -3,30 +3,32 @@ name: Goose CI
33
on:
44
push:
55
branches:
6-
- master
6+
- main
77
pull_request:
8+
workflow_dispatch:
9+
10+
concurrency:
11+
group: ${{ github.workflow }}-${{ github.ref }}
12+
cancel-in-progress: true
813

914
jobs:
1015
test:
1116
name: Run unit tests
1217
timeout-minutes: 10
1318

14-
concurrency:
15-
group: test-${{ github.ref }}-${{ matrix.os }}-${{ matrix.go-version }}
16-
cancel-in-progress: true
1719
strategy:
1820
fail-fast: false
1921
matrix:
20-
go-version: ["1.20", "1.21", "1.22"]
22+
go-version: [oldstable, stable]
2123
os: [ubuntu-latest]
2224

2325
runs-on: ${{ matrix.os }}
2426

2527
steps:
2628
- name: Checkout code
27-
uses: actions/checkout@v4
29+
uses: actions/checkout@v5
2830
- name: Install Go
29-
uses: actions/setup-go@v5
31+
uses: actions/setup-go@v6
3032
with:
3133
go-version: ${{ matrix.go-version }}
3234
- name: Check Go code formatting
@@ -36,18 +38,23 @@ jobs:
3638
echo "Please format Go code by running: go fmt ./..."
3739
exit 1
3840
fi
41+
- name: Install tparse
42+
run: go install github.com/mfridman/tparse@main
3943
- name: Run tests
4044
run: |
45+
make add-gowork
4146
mkdir -p bin
4247
go vet ./...
4348
go build ./...
4449
make test-packages
4550
- name: Install GoReleaser
46-
if: github.event_name == 'push' && github.ref == 'refs/heads/master' && matrix.go-version == '1.22'
47-
uses: goreleaser/goreleaser-action@v5
51+
if: github.event_name == 'push' && github.ref == 'refs/heads/main' && matrix.go-version == 'stable'
52+
uses: goreleaser/goreleaser-action@v6
4853
with:
4954
install-only: true
55+
distribution: goreleaser
56+
version: "~> v2"
5057
- name: Gorelease dry-run
51-
if: github.event_name == 'push' && github.ref == 'refs/heads/master' && matrix.go-version == '1.22'
58+
if: github.event_name == 'push' && github.ref == 'refs/heads/main' && matrix.go-version == 'stable'
5259
run: |
5360
goreleaser release --skip=publish --snapshot --fail-fast --clean

.github/workflows/integration.yaml

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,9 @@ name: Goose integration tests
33
on:
44
push:
55
branches:
6-
- master
6+
- main
77
pull_request:
8+
workflow_dispatch:
89

910
concurrency:
1011
group: ${{ github.workflow }}-${{ github.ref }}
@@ -18,11 +19,13 @@ jobs:
1819

1920
steps:
2021
- name: Checkout code
21-
uses: actions/checkout@v4
22+
uses: actions/checkout@v5
2223
- name: Install Go
23-
uses: actions/setup-go@v5
24+
uses: actions/setup-go@v6
2425
with:
2526
go-version: "stable"
27+
- name: Install tparse
28+
run: go install github.com/mfridman/tparse@main
2629
- name: Run full integration tests
2730
run: |
2831
make test-integration

.github/workflows/lint.yaml

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,9 +3,9 @@ name: golangci
33
on:
44
push:
55
branches:
6-
- master
76
- main
87
pull_request:
8+
workflow_dispatch:
99

1010
concurrency:
1111
group: ${{ github.workflow }}-${{ github.ref }}
@@ -17,12 +17,13 @@ jobs:
1717
runs-on: ubuntu-latest
1818
steps:
1919
- name: Checkout code
20-
uses: actions/checkout@v4
21-
- uses: actions/setup-go@v5
20+
uses: actions/checkout@v5
21+
- uses: actions/setup-go@v6
2222
with:
2323
go-version: "stable"
24+
- run: make add-gowork
2425
- name: golangci-lint
25-
uses: golangci/golangci-lint-action@v6
26+
uses: golangci/golangci-lint-action@v8
2627
with:
2728
# Optional: version of golangci-lint to use in form of v1.2 or v1.2.3 or `latest` to use the latest version
2829
version: latest

.github/workflows/release.yaml

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -9,21 +9,22 @@ jobs:
99
goreleaser:
1010
runs-on: ubuntu-latest
1111
steps:
12-
- uses: actions/checkout@v4
12+
- uses: actions/checkout@v5
1313
with:
1414
fetch-depth: 0
1515
- run: git fetch --force --tags
16-
- uses: actions/setup-go@v5
16+
- uses: actions/setup-go@v6
1717
with:
1818
go-version: stable
1919
- name: Generate release notes
2020
continue-on-error: true
2121
run: ./scripts/release-notes.sh ${{github.ref_name}} > ${{runner.temp}}/release_notes.txt
22+
- run: make add-gowork
2223
- name: Run GoReleaser
23-
uses: goreleaser/goreleaser-action@v5
24+
uses: goreleaser/goreleaser-action@v6
2425
with:
2526
distribution: goreleaser
26-
version: latest
27+
version: "~> v2"
2728
args: release --clean --release-notes=${{runner.temp}}/release_notes.txt
2829
env:
2930
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

.gitignore

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,10 @@
77
# Files output by tests
88
/bin
99

10+
# Coverage files
11+
coverage.out
12+
coverage.html
13+
1014
# Local testing
1115
.envrc
1216
*.FAIL

.golangci.yaml

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
version: "2"
2+
linters:
3+
default: none
4+
enable:
5+
- errcheck
6+
- govet
7+
- ineffassign
8+
- misspell
9+
- staticcheck
10+
- testifylint
11+
- unused
12+
exclusions:
13+
generated: lax
14+
presets:
15+
- comments
16+
- common-false-positives
17+
- legacy
18+
- std-error-handling
19+
paths:
20+
- third_party$
21+
- builtin$
22+
- examples$
23+
formatters:
24+
enable:
25+
- gofmt
26+
exclusions:
27+
generated: lax
28+
paths:
29+
- third_party$
30+
- builtin$
31+
- examples$

.goreleaser.yaml

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
# yaml-language-server: $schema=https://goreleaser.com/static/schema.json
22
#
33
# See https://goreleaser.com/customization/ for more information.
4+
version: 2
45
project_name: goose
56

67
before:
@@ -24,12 +25,13 @@ builds:
2425
- "-s -w -X main.version=v{{ .Version }}"
2526

2627
archives:
27-
- format: binary
28+
- formats:
29+
- binary
2830
name_template: >-
2931
{{ .ProjectName }}_{{- tolower .Os }}_{{- if eq .Arch "amd64" }}x86_64{{- else }}{{ .Arch }}{{ end }}
3032
checksum:
3133
name_template: "checksums.txt"
3234
snapshot:
33-
name_template: "{{ incpatch .Version }}-next"
35+
version_template: "{{ incpatch .Version }}-next"
3436
changelog:
3537
use: github-native

CHANGELOG.md

Lines changed: 138 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,127 @@ All notable changes to this project will be documented in this file.
55
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/), and this project
66
adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
77

8-
## [Unreleased]
8+
## Unreleased
9+
10+
- Support [environ credentials](https://github.com/ydb-platform/ydb-go-sdk-auth-environ/?tab=readme-ov-file#auth-environment-variables)
11+
for YDB using parameter `use_env_credentials` in connection string.
12+
Example:
13+
```bash
14+
export YDB_ACCESS_TOKEN_CREDENTIALS="my-secret-token"
15+
goose ydb "grpcs://localhost:2135/local?go_query_mode=scripting&go_fake_tx=scripting&go_query_bind=declare,numeric&use_env_credentials" status
16+
```
17+
- Add preliminary Spanner dialect support (#966)
18+
- Remove `StatementBegin` and `StatementEnd` annotations from SQL migration templates
19+
- This is only required for more complex statements that include semicolons within them, such as
20+
stored procedures or functions. For simple statements, these annotations are not needed. See
21+
[docs](https://pressly.github.io/goose/documentation/annotations/#complex-statements) for more
22+
details.
23+
24+
## [v3.26.0] - 2025-10-03
25+
26+
- Add `*slog.Logger` support to goose provider via option `WithSlog` (#989)
27+
- Add convenience `WithTableName` provider option (#985)
28+
- Minor bug fixes and dependency upgrades
29+
- Add general purpose `Locker` interface to support DB locking with a table-based Postgres
30+
implementation via `lock.NewPostgresTableLocker` (#993 for more details)
31+
- Unlike `SessionLocker`, this uses the `*sql.DB` connection pool
32+
- Add `WithLocker` option to goose provider
33+
34+
## [v3.25.0] - 2025-08-24
35+
36+
- Upgrade go deps (#976)
37+
- Remove references/tests for vertica and add deprecation warnings (#978)
38+
- Add Aurora DSQL as a new database dialect to goose `Provider` (#971)
39+
- Add DDL isolation support for Aurora DSQL compatibility (#970)
40+
- Update Apply to respect no versioning option (#950)
41+
- Expose dialect `Querier` (#939)
42+
43+
## [v3.24.3]
44+
45+
- Add `GOOSE_TABLE` environment variable -- lower priority than `-table` flag, but higher than the
46+
default table name. (#932)
47+
- Dependency updates
48+
49+
## [v3.24.2]
50+
51+
- Add `TableExists` table existence check for the mysql dialect (#895)
52+
- Upgrade **minimum Go version to 1.23**
53+
- Various dependency updates
54+
55+
## [v3.24.1]
56+
57+
- Fix regression (`v3.23.1` and `v3.24.0`) in postgres migration table existence check for
58+
non-default schema. (#882, #883, #884).
59+
60+
## [v3.24.0]
61+
62+
- Add support for loading environment variables from `.env` files, enabled by default.
63+
- The default file name is `.env`, but can be changed with the `-env=<filename>` flag.
64+
- To disable this feature, set `-env=none`.
65+
66+
## [v3.23.1]
67+
68+
- Store implementations can **optionally** implement the `TableExists` method to provide optimized
69+
table existence checks (#860)
70+
- Default postgres Store implementation updated to use `pg_tables` system catalog, more to follow
71+
- Backward compatible change - existing implementations will continue to work without modification
72+
73+
```go
74+
TableExists(ctx context.Context, db database.DBTxConn) (bool, error)
75+
```
76+
77+
## [v3.23.0]
78+
79+
- Add `WithLogger` to `NewProvider` to allow custom loggers (#833)
80+
- Update Provider `WithVerbose` behavior to log all SQL statements (#851)
81+
- Upgrade dependencies and rebuild binaries with latest Go version (`go1.23.3`)
82+
83+
## [v3.22.1]
84+
85+
- Upgrade dependencies and rebuild binaries with latest Go version (`go1.23.1`)
86+
87+
## [v3.22.0]
88+
89+
- Minimum Go version is now 1.21
90+
- Add Unwrap to PartialError (#815)
91+
- Allow flags anywhere on the CLI (#814)
92+
93+
`goose` uses the default Go `flag` parsing library, which means flags **must** be defined before the
94+
first positional argument. We've updated this behavior to allow flags to be defined anywhere. For
95+
more details, see [blog post](https://mfridman.com/blog/2024/allowing-flags-anywhere-on-the-cli/).
96+
97+
- Update `WithDisableGlobalRegistry` behavior (#783). When set, this will ignore globally-registered
98+
migrationse entirely instead of the previous behavior of raising an error. Specifically, the
99+
following check is removed:
100+
101+
```go
102+
if len(global) > 0 {
103+
return nil, errors.New("global registry disabled, but provider has registered go migrations")
104+
}
105+
```
106+
107+
This enables creating isolated goose provider(s) in legacy environments where global migrations may
108+
be registered. Without updating this behavior, it would be impossible to use
109+
`WithDisableGlobalRegistry` in combination with provider-scoped `WithGoMigrations`.
110+
111+
- Postgres, updated schema to use identity instead of serial and make `tstamp` not nullable (#556)
112+
113+
```diff
114+
- id serial NOT NULL,
115+
+ id integer PRIMARY KEY GENERATED BY DEFAULT AS IDENTITY,
116+
117+
- tstamp timestamp NULL default now(),
118+
+ tstamp timestamp NOT NULL DEFAULT now()
119+
```
120+
121+
- MySQL, updated schema to not use SERIAL alias (#816)
122+
123+
```diff
124+
- id serial NOT NULL,
125+
+ id bigint(20) unsigned NOT NULL AUTO_INCREMENT,
126+
```
127+
128+
## [v3.21.1]
9129

10130
- Add `GetVersions` method to `goose.Provider`, returns the current (max db) version and the latest
11131
(max filesystem) version. (#756)
@@ -18,13 +138,9 @@ adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
18138
to get the latest version_id irrespective of the order of applied migrations.
19139
- Refactor existing portions of the code to use the new `GetLatestVersion` method.
20140

21-
- Support [environ credentials](https://github.com/ydb-platform/ydb-go-sdk-auth-environ/?tab=readme-ov-file#auth-environment-variables)
22-
for YDB using parameter `use_env_credentials` in connection string.
23-
Example:
24-
```bash
25-
export YDB_ACCESS_TOKEN_CREDENTIALS="my-secret-token"
26-
goose ydb "grpcs://localhost:2135/local?go_query_mode=scripting&go_fake_tx=scripting&go_query_bind=declare,numeric&use_env_credentials" status
27-
```
141+
## [v3.21.0]
142+
143+
- Retracted. Broken release, please use v3.21.1 instead.
28144

29145
## [v3.20.0]
30146

@@ -151,7 +267,7 @@ Here's a quick summary:
151267

152268
- Fix `sqlparser` to avoid skipping the last statement when it's not terminated with a semicolon
153269
within a StatementBegin/End block. (#580)
154-
- Add `go1.21` to the CI matrix.
270+
- Add `**go1.21**` to the CI matrix.
155271
- Bump minimum version of module in go.mod to `go1.19`.
156272
- Fix version output when installing pre-built binaries (#585).
157273
@@ -189,7 +305,19 @@ Here's a quick summary:
189305
- Add new `context.Context`-aware functions and methods, for both sql and go migrations.
190306
- Return error when no migration files found or dir is not a directory.
191307

192-
[Unreleased]: https://github.com/pressly/goose/compare/v3.20.0...HEAD
308+
[Unreleased]: https://github.com/pressly/goose/compare/v3.26.0...HEAD
309+
[v3.26.0]: https://github.com/pressly/goose/compare/v3.25.0...v3.26.0
310+
[v3.25.0]: https://github.com/pressly/goose/compare/v3.24.3...v3.25.0
311+
[v3.24.3]: https://github.com/pressly/goose/compare/v3.24.2...v3.24.3
312+
[v3.24.2]: https://github.com/pressly/goose/compare/v3.24.1...v3.24.2
313+
[v3.24.1]: https://github.com/pressly/goose/compare/v3.24.0...v3.24.1
314+
[v3.24.0]: https://github.com/pressly/goose/compare/v3.23.1...v3.24.0
315+
[v3.23.1]: https://github.com/pressly/goose/compare/v3.23.0...v3.23.1
316+
[v3.23.0]: https://github.com/pressly/goose/compare/v3.22.1...v3.23.0
317+
[v3.22.1]: https://github.com/pressly/goose/compare/v3.22.0...v3.22.1
318+
[v3.22.0]: https://github.com/pressly/goose/compare/v3.21.1...v3.22.0
319+
[v3.21.1]: https://github.com/pressly/goose/compare/v3.20.0...v3.21.1
320+
[v3.21.0]: https://github.com/pressly/goose/compare/v3.20.0...v3.21.0
193321
[v3.20.0]: https://github.com/pressly/goose/compare/v3.19.2...v3.20.0
194322
[v3.19.2]: https://github.com/pressly/goose/compare/v3.19.1...v3.19.2
195323
[v3.19.1]: https://github.com/pressly/goose/compare/v3.19.0...v3.19.1

0 commit comments

Comments
 (0)