Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
32 commits
Select commit Hold shift + click to select a range
da72428
Update README.md
adityassharma-ss Jun 4, 2024
41e389a
Support .deb package for Noble Numbat (24.04)
muzammilar Jul 17, 2024
899a244
Fix redshift tests
dhui Aug 30, 2024
e1a7e31
Use forked version of postgres 8 to avoid Docker image format version…
dhui Sep 6, 2024
f44379d
Merge pull request #1151 from dhui/fix-redshift-tests
dhui Sep 6, 2024
1b1c6f6
Use newer math/rand/v2
dhui Aug 26, 2024
897be38
chore: remove deprecated `rand.Seed()` in testing.docker (#1149)
joschi Sep 7, 2024
d28e549
Update dktest from v0.4.1 to v0.4.2
dhui Sep 7, 2024
ee93fd4
build: use Go 1.23 to build the project
joschi Aug 13, 2024
f4d986b
test(mysql): run tests with MySQL 8.0, 8.4, and 9.0
joschi Aug 7, 2024
0444ec8
test(postgres): run tests with PostgreSQL 16
joschi Aug 7, 2024
6ceb5a9
fix(tests): fix Docker imports
joschi Sep 7, 2024
e40e64c
Merge pull request #1133 from joschi/go-1.23
dhui Sep 8, 2024
65a3bd5
Merge pull request #1153 from joschi/fix-docker-imports
dhui Sep 8, 2024
7e8f6be
Merge pull request #1126 from joschi/tests-postgres-16
dhui Sep 8, 2024
ddd7fa6
Merge pull request #1127 from joschi/tests-mysql-9
dhui Sep 8, 2024
5b6f623
Bump google.golang.org/grpc from 1.64.0 to 1.64.1
dependabot[bot] Sep 8, 2024
1e02b42
Merge pull request #1119 from muzammilar/add-noble-numbat
dhui Sep 8, 2024
67c71f9
Merge pull request #1152 from golang-migrate/dependabot/go_modules/go…
dhui Sep 8, 2024
d5eb594
Merge pull request #1101 from adityassharma-ss/patch-1
dhui Sep 8, 2024
555501f
Update dktest from v0.4.2 to v0.4.3
dhui Sep 8, 2024
e22d012
Don't output sensitive information on error
Sep 12, 2024
c378583
Merge pull request #1162 from rselbach/rselbach/no-sensitive-info
dhui Sep 23, 2024
bc06922
Update dktest from v0.4.3 to v0.4.4
dhui Jan 26, 2025
12c619e
Fix CI (#1222)
dhui Jan 26, 2025
e5a152b
Drop support for Azure SQL Edge
dhui Jan 27, 2025
7651c8a
linter fixes
dhui Jan 27, 2025
e145cde
Bump github.com/golang-jwt/jwt/v4 from 4.4.2 to 4.5.1
dependabot[bot] Jan 27, 2025
d477553
Merge pull request #1195 from golang-migrate/dependabot/go_modules/gi…
dhui Jan 27, 2025
03ede2a
Merge golang-migrate-master
lukespice Feb 3, 2025
4cea624
Fix merge conflict
lukespice Feb 3, 2025
a670d5b
Remove one require block
lukespice Feb 3, 2025
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 9 additions & 6 deletions .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -9,20 +9,20 @@ jobs:
name: lint
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-go@v5
with:
go-version: "1.22.x"
- uses: actions/checkout@v4
go-version: "1.23.x"
- name: golangci-lint
uses: golangci/golangci-lint-action@v4
uses: golangci/golangci-lint-action@v6
with:
version: latest
version: v1.63.4

test:
runs-on: ubuntu-latest
strategy:
matrix:
go: ["1.21.x", "1.22.x"]
go: ["1.22.x", "1.23.x"]
steps:
- uses: actions/checkout@v4

Expand Down Expand Up @@ -68,7 +68,7 @@ jobs:
ruby-version: 2.7
- uses: actions/setup-go@v5
with:
go-version: "1.22.x"
go-version: "1.23.x"

- uses: docker/setup-qemu-action@v3
- uses: docker/setup-buildx-action@v3
Expand Down Expand Up @@ -97,6 +97,9 @@ jobs:
- run: package_cloud push golang-migrate/migrate/ubuntu/jammy dist/migrate.linux-amd64.deb
env:
PACKAGECLOUD_TOKEN: ${{ secrets.PACKAGECLOUD_TOKEN }}
- run: package_cloud push golang-migrate/migrate/ubuntu/noble dist/migrate.linux-amd64.deb
env:
PACKAGECLOUD_TOKEN: ${{ secrets.PACKAGECLOUD_TOKEN }}
- run: package_cloud push golang-migrate/migrate/debian/buster dist/migrate.linux-amd64.deb
env:
PACKAGECLOUD_TOKEN: ${{ secrets.PACKAGECLOUD_TOKEN }}
Expand Down
4 changes: 2 additions & 2 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
FROM golang:1.22-alpine3.19 AS builder
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

FYI 3.21 is available.

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks, but just keeping up to date with upstream rather than getting ahead https://github.com/golang-migrate/migrate/blob/d477553dcd9ae33e2698c09f186e988767d71b79/Dockerfile#L1

FROM golang:1.23-alpine3.20 AS builder
ARG VERSION

RUN apk add --no-cache git gcc musl-dev make
Expand All @@ -15,7 +15,7 @@ COPY . ./

RUN make build-docker

FROM alpine:3.19
FROM alpine:3.20

RUN apk add --no-cache ca-certificates

Expand Down
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
[![Coverage Status](https://img.shields.io/coveralls/github/golang-migrate/migrate/master.svg)](https://coveralls.io/github/golang-migrate/migrate?branch=master)
[![packagecloud.io](https://img.shields.io/badge/deb-packagecloud.io-844fec.svg)](https://packagecloud.io/golang-migrate/migrate?filter=debs)
[![Docker Pulls](https://img.shields.io/docker/pulls/migrate/migrate.svg)](https://hub.docker.com/r/migrate/migrate/)
![Supported Go Versions](https://img.shields.io/badge/Go-1.21%2C%201.22-lightgrey.svg)
![Supported Go Versions](https://img.shields.io/badge/Go-1.22%2C%201.23-lightgrey.svg)
[![GitHub Release](https://img.shields.io/github/release/golang-migrate/migrate.svg)](https://github.com/golang-migrate/migrate/releases)
[![Go Report Card](https://goreportcard.com/badge/github.com/golang-migrate/migrate/v4)](https://goreportcard.com/report/github.com/golang-migrate/migrate/v4)

Expand Down Expand Up @@ -145,7 +145,7 @@ func main() {
m, err := migrate.NewWithDatabaseInstance(
"file:///migrations",
"postgres", driver)
m.Up() // or m.Step(2) if you want to explicitly set the number of migrations to run
m.Up() // or m.Steps(2) if you want to explicitly set the number of migrations to run
}
```

Expand Down
12 changes: 6 additions & 6 deletions database/cockroachdb/cockroachdb_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -26,13 +26,13 @@ import (
const defaultPort = 26257

var (
opts = dktest.Options{Cmd: []string{"start", "--insecure"}, PortRequired: true, ReadyFunc: isReady}
// Released versions: https://www.cockroachlabs.com/docs/releases/
opts = dktest.Options{Cmd: []string{"start-single-node", "--insecure"}, PortRequired: true, ReadyFunc: isReady}
// Supported versions: https://www.cockroachlabs.com/docs/releases/release-support-policy#supported-versions
specs = []dktesting.ContainerSpec{
{ImageName: "cockroachdb/cockroach:v1.0.7", Options: opts},
{ImageName: "cockroachdb/cockroach:v1.1.9", Options: opts},
{ImageName: "cockroachdb/cockroach:v2.0.7", Options: opts},
{ImageName: "cockroachdb/cockroach:v2.1.3", Options: opts},
{ImageName: "cockroachdb/cockroach:latest-v24.3", Options: opts},
{ImageName: "cockroachdb/cockroach:latest-v24.1", Options: opts},
{ImageName: "cockroachdb/cockroach:latest-v23.2", Options: opts},
{ImageName: "cockroachdb/cockroach:latest-v23.1", Options: opts},
}
)

Expand Down
14 changes: 6 additions & 8 deletions database/mysql/mysql_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -40,16 +40,14 @@ var (
}
// Supported versions: https://www.mysql.com/support/supportedplatforms/database.html
specs = []dktesting.ContainerSpec{
{ImageName: "mysql:5.5", Options: opts},
{ImageName: "mysql:5.6", Options: opts},
{ImageName: "mysql:5.7", Options: opts},
{ImageName: "mysql:8", Options: opts},
{ImageName: "mysql:8.0", Options: opts},
{ImageName: "mysql:8.4", Options: opts},
{ImageName: "mysql:9.0", Options: opts},
}
specsAnsiQuotes = []dktesting.ContainerSpec{
{ImageName: "mysql:5.5", Options: optsAnsiQuotes},
{ImageName: "mysql:5.6", Options: optsAnsiQuotes},
{ImageName: "mysql:5.7", Options: optsAnsiQuotes},
{ImageName: "mysql:8", Options: optsAnsiQuotes},
{ImageName: "mysql:8.0", Options: optsAnsiQuotes},
{ImageName: "mysql:8.4", Options: optsAnsiQuotes},
{ImageName: "mysql:9.0", Options: optsAnsiQuotes},
}
)

Expand Down
3 changes: 2 additions & 1 deletion database/pgx/pgx_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -34,10 +34,11 @@ var (
PortRequired: true, ReadyFunc: isReady}
// Supported versions: https://www.postgresql.org/support/versioning/
specs = []dktesting.ContainerSpec{
{ImageName: "postgres:12", Options: opts},
{ImageName: "postgres:13", Options: opts},
{ImageName: "postgres:14", Options: opts},
{ImageName: "postgres:15", Options: opts},
{ImageName: "postgres:16", Options: opts},
{ImageName: "postgres:17", Options: opts},
}
)

Expand Down
1 change: 1 addition & 0 deletions database/pgx/v5/pgx_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@ var (
{ImageName: "postgres:13", Options: opts},
{ImageName: "postgres:14", Options: opts},
{ImageName: "postgres:15", Options: opts},
{ImageName: "postgres:16", Options: opts},
}
)

Expand Down
3 changes: 2 additions & 1 deletion database/postgres/postgres_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -35,10 +35,11 @@ var (
PortRequired: true, ReadyFunc: isReady}
// Supported versions: https://www.postgresql.org/support/versioning/
specs = []dktesting.ContainerSpec{
{ImageName: "postgres:12", Options: opts},
{ImageName: "postgres:13", Options: opts},
{ImageName: "postgres:14", Options: opts},
{ImageName: "postgres:15", Options: opts},
{ImageName: "postgres:16", Options: opts},
{ImageName: "postgres:17", Options: opts},
}
)

Expand Down
19 changes: 14 additions & 5 deletions database/redshift/redshift_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -25,10 +25,19 @@ import (
_ "github.com/golang-migrate/migrate/v4/source/file"
)

const (
pgPassword = "redshift"
)

var (
opts = dktest.Options{PortRequired: true, ReadyFunc: isReady}
opts = dktest.Options{
Env: map[string]string{"POSTGRES_PASSWORD": pgPassword},
PortRequired: true,
ReadyFunc: isReady,
}

specs = []dktesting.ContainerSpec{
{ImageName: "joschi/postgres8:8", Options: opts},
{ImageName: "migrate/postgres8:8", Options: opts},
}
)

Expand All @@ -41,7 +50,7 @@ func pgConnectionString(host, port string) string {
}

func connectionString(schema, host, port string) string {
return fmt.Sprintf("%s://postgres@%s:%s/postgres?sslmode=disable", schema, host, port)
return fmt.Sprintf("%s://postgres:%s@%s:%s/postgres?sslmode=disable", schema, pgPassword, host, port)
}

func isReady(ctx context.Context, c dktest.ContainerInfo) bool {
Expand Down Expand Up @@ -189,7 +198,7 @@ func TestFilterCustomQuery(t *testing.T) {
t.Fatal(err)
}

addr := fmt.Sprintf("postgres://postgres@%v:%v/postgres?sslmode=disable&x-custom=foobar", ip, port)
addr := fmt.Sprintf("postgres://postgres:%s@%v:%v/postgres?sslmode=disable&x-custom=foobar", pgPassword, ip, port)
p := &Redshift{}
d, err := p.Open(addr)
if err != nil {
Expand Down Expand Up @@ -231,7 +240,7 @@ func TestWithSchema(t *testing.T) {
}

// re-connect using that schema
d2, err := p.Open(fmt.Sprintf("postgres://postgres@%v:%v/postgres?sslmode=disable&search_path=foobar", ip, port))
d2, err := p.Open(fmt.Sprintf("postgres://postgres:%s@%v:%v/postgres?sslmode=disable&search_path=foobar", pgPassword, ip, port))
if err != nil {
t.Fatal(err)
}
Expand Down
18 changes: 3 additions & 15 deletions database/sqlserver/sqlserver_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@ import (
"time"

"github.com/dhui/dktest"
"github.com/docker/go-connections/nat"
"github.com/golang-migrate/migrate/v4"

dt "github.com/golang-migrate/migrate/v4/database/testing"
Expand All @@ -25,27 +24,16 @@ const defaultPort = 1433
const saPassword = "Root1234"

var (
sqlEdgeOpts = dktest.Options{
Env: map[string]string{"ACCEPT_EULA": "Y", "MSSQL_SA_PASSWORD": saPassword},
PortBindings: map[nat.Port][]nat.PortBinding{
nat.Port(fmt.Sprintf("%d/tcp", defaultPort)): {
nat.PortBinding{
HostIP: "0.0.0.0",
HostPort: "0/tcp",
},
},
},
PortRequired: true, ReadyFunc: isReady, PullTimeout: 2 * time.Minute,
}
sqlServerOpts = dktest.Options{
Env: map[string]string{"ACCEPT_EULA": "Y", "MSSQL_SA_PASSWORD": saPassword, "MSSQL_PID": "Express"},
PortRequired: true, ReadyFunc: isReady, PullTimeout: 2 * time.Minute,
}
// Container versions: https://mcr.microsoft.com/v2/mssql/server/tags/list
specs = []dktesting.ContainerSpec{
{ImageName: "mcr.microsoft.com/azure-sql-edge:latest", Options: sqlEdgeOpts},
{ImageName: "mcr.microsoft.com/mssql/server:2017-latest", Options: sqlServerOpts},
{ImageName: "mcr.microsoft.com/mssql/server:2022-latest", Options: sqlServerOpts},
{ImageName: "mcr.microsoft.com/mssql/server:2019-latest", Options: sqlServerOpts},
// Add back support for 2017 version once the image is fixed: https://github.com/microsoft/mssql-docker/issues/899
// {ImageName: "mcr.microsoft.com/mssql/server:2017-latest", Options: sqlServerOpts},
}
)

Expand Down
6 changes: 2 additions & 4 deletions dktesting/dktesting.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,9 @@ import (
"context"
"fmt"
"testing"
)

import (
"github.com/dhui/dktest"
"github.com/docker/docker/api/types"
"github.com/docker/docker/api/types/image"
"github.com/docker/docker/client"
)

Expand Down Expand Up @@ -36,7 +34,7 @@ func (s *ContainerSpec) Cleanup() (retErr error) {
}
ctx, timeoutCancelFunc := context.WithTimeout(context.Background(), cleanupTimeout)
defer timeoutCancelFunc()
if _, err := dc.ImageRemove(ctx, s.ImageName, types.ImageRemoveOptions{Force: true, PruneChildren: true}); err != nil {
if _, err := dc.ImageRemove(ctx, s.ImageName, image.RemoveOptions{Force: true, PruneChildren: true}); err != nil {
return err
}
return nil
Expand Down
Loading