Skip to content

Commit d47e437

Browse files
committed
fixed merged conflict
2 parents 8447691 + 2477f63 commit d47e437

File tree

20 files changed

+237
-108
lines changed

20 files changed

+237
-108
lines changed

.github/workflows/ci.yaml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -11,18 +11,18 @@ jobs:
1111
steps:
1212
- uses: actions/setup-go@v5
1313
with:
14-
go-version: "1.21.x"
14+
go-version: "1.22.x"
1515
- uses: actions/checkout@v4
1616
- name: golangci-lint
17-
uses: golangci/golangci-lint-action@v3
17+
uses: golangci/golangci-lint-action@v4
1818
with:
1919
version: latest
2020

2121
test:
2222
runs-on: ubuntu-latest
2323
strategy:
2424
matrix:
25-
go: ["1.20.x", "1.21.x"]
25+
go: ["1.21.x", "1.22.x"]
2626
steps:
2727
- uses: actions/checkout@v4
2828

@@ -68,7 +68,7 @@ jobs:
6868
ruby-version: 2.7
6969
- uses: actions/setup-go@v5
7070
with:
71-
go-version: "1.21.x"
71+
go-version: "1.22.x"
7272

7373
- uses: docker/setup-qemu-action@v3
7474
- uses: docker/setup-buildx-action@v3

.golangci.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ run:
44
linters:
55
enable:
66
#- golint
7-
- interfacer
7+
#- interfacer
88
- unconvert
99
#- dupl
1010
- goconst

Dockerfile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
FROM golang:1.21-alpine3.19 AS builder
1+
FROM golang:1.22-alpine3.19 AS builder
22
ARG VERSION
33

44
RUN apk add --no-cache git gcc musl-dev make

README.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
[![Coverage Status](https://img.shields.io/coveralls/github/golang-migrate/migrate/master.svg)](https://coveralls.io/github/golang-migrate/migrate?branch=master)
44
[![packagecloud.io](https://img.shields.io/badge/deb-packagecloud.io-844fec.svg)](https://packagecloud.io/golang-migrate/migrate?filter=debs)
55
[![Docker Pulls](https://img.shields.io/docker/pulls/migrate/migrate.svg)](https://hub.docker.com/r/migrate/migrate/)
6-
![Supported Go Versions](https://img.shields.io/badge/Go-1.20%2C%201.21-lightgrey.svg)
6+
![Supported Go Versions](https://img.shields.io/badge/Go-1.21%2C%201.22-lightgrey.svg)
77
[![GitHub Release](https://img.shields.io/github/release/golang-migrate/migrate.svg)](https://github.com/golang-migrate/migrate/releases)
88
[![Go Report Card](https://goreportcard.com/badge/github.com/golang-migrate/migrate/v4)](https://goreportcard.com/report/github.com/golang-migrate/migrate/v4)
99

@@ -43,7 +43,7 @@ Database drivers run migrations. [Add a new database?](database/driver.go)
4343
* [ClickHouse](database/clickhouse)
4444
* [Firebird](database/firebird)
4545
* [MS SQL Server](database/sqlserver)
46-
* [RQLite](database/rqlite)
46+
* [rqlite](database/rqlite)
4747

4848
### Database URLs
4949

@@ -174,7 +174,7 @@ Each migration has an up and down migration. [Why?](FAQ.md#why-two-separate-file
174174
## Coming from another db migration tool?
175175

176176
Check out [migradaptor](https://github.com/musinit/migradaptor/).
177-
*Note: migradaptor is not affliated or supported by this project*
177+
*Note: migradaptor is not affiliated or supported by this project*
178178

179179
## Versions
180180

database/cassandra/cassandra_test.go

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -61,6 +61,20 @@ func isReady(ctx context.Context, c dktest.ContainerInfo) bool {
6161
}
6262

6363
func Test(t *testing.T) {
64+
t.Run("test", test)
65+
t.Run("testMigrate", testMigrate)
66+
67+
t.Cleanup(func() {
68+
for _, spec := range specs {
69+
t.Log("Cleaning up ", spec.ImageName)
70+
if err := spec.Cleanup(); err != nil {
71+
t.Error("Error removing ", spec.ImageName, "error:", err)
72+
}
73+
}
74+
})
75+
}
76+
77+
func test(t *testing.T) {
6478
dktesting.ParallelTest(t, specs, func(t *testing.T, c dktest.ContainerInfo) {
6579
ip, port, err := c.Port(9042)
6680
if err != nil {
@@ -81,7 +95,7 @@ func Test(t *testing.T) {
8195
})
8296
}
8397

84-
func TestMigrate(t *testing.T) {
98+
func testMigrate(t *testing.T) {
8599
dktesting.ParallelTest(t, specs, func(t *testing.T, c dktest.ContainerInfo) {
86100
ip, port, err := c.Port(9042)
87101
if err != nil {

database/clickhouse/README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616

1717
## Notes
1818

19-
* The Clickhouse driver does not natively support executing multipe statements in a single query. To allow for multiple statements in a single migration, you can use the `x-multi-statement` param. There are two important caveats:
19+
* The Clickhouse driver does not natively support executing multiple statements in a single query. To allow for multiple statements in a single migration, you can use the `x-multi-statement` param. There are two important caveats:
2020
* This mode splits the migration text into separately-executed statements by a semi-colon `;`. Thus `x-multi-statement` cannot be used when a statement in the migration contains a string with a semi-colon.
2121
* The queries are not executed in any sort of transaction/batch, meaning you are responsible for fixing partial migrations.
2222
* Using the default TinyLog table engine for the schema_versions table prevents backing up the table if using the [clickhouse-backup](https://github.com/AlexAkulov/clickhouse-backup) tool. If backing up the database with make sure the migrations are run with `x-migrations-table-engine=MergeTree`.

database/cockroachdb/TUTORIAL.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ CREATE USER IF NOT EXISTS cockroach;
1515
GRANT ALL ON DATABASE example TO cockroach;
1616
```
1717

18-
When using Migrate CLI we need to pass to database URL. Let's export it to a variable for convienience:
18+
When using Migrate CLI we need to pass to database URL. Let's export it to a variable for convenience:
1919
```
2020
export COCKROACHDB_URL='cockroachdb://cockroach:@localhost:26257/example?sslmode=disable'
2121
```

database/mongodb/mongodb_test.go

Lines changed: 28 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -74,6 +74,22 @@ func isReady(ctx context.Context, c dktest.ContainerInfo) bool {
7474
}
7575

7676
func Test(t *testing.T) {
77+
t.Run("test", test)
78+
t.Run("testMigrate", testMigrate)
79+
t.Run("testWithAuth", testWithAuth)
80+
t.Run("testLockWorks", testLockWorks)
81+
82+
t.Cleanup(func() {
83+
for _, spec := range specs {
84+
t.Log("Cleaning up ", spec.ImageName)
85+
if err := spec.Cleanup(); err != nil {
86+
t.Error("Error removing ", spec.ImageName, "error:", err)
87+
}
88+
}
89+
})
90+
}
91+
92+
func test(t *testing.T) {
7793
dktesting.ParallelTest(t, specs, func(t *testing.T, c dktest.ContainerInfo) {
7894
ip, port, err := c.FirstPort()
7995
if err != nil {
@@ -99,7 +115,7 @@ func Test(t *testing.T) {
99115
})
100116
}
101117

102-
func TestMigrate(t *testing.T) {
118+
func testMigrate(t *testing.T) {
103119
dktesting.ParallelTest(t, specs, func(t *testing.T, c dktest.ContainerInfo) {
104120
ip, port, err := c.FirstPort()
105121
if err != nil {
@@ -125,7 +141,7 @@ func TestMigrate(t *testing.T) {
125141
})
126142
}
127143

128-
func TestWithAuth(t *testing.T) {
144+
func testWithAuth(t *testing.T) {
129145
dktesting.ParallelTest(t, specs, func(t *testing.T, c dktest.ContainerInfo) {
130146
ip, port, err := c.FirstPort()
131147
if err != nil {
@@ -180,7 +196,7 @@ func TestWithAuth(t *testing.T) {
180196
})
181197
}
182198

183-
func TestLockWorks(t *testing.T) {
199+
func testLockWorks(t *testing.T) {
184200
dktesting.ParallelTest(t, specs, func(t *testing.T, c dktest.ContainerInfo) {
185201
ip, port, err := c.FirstPort()
186202
if err != nil {
@@ -241,6 +257,15 @@ func TestTransaction(t *testing.T) {
241257
{ImageName: "mongo:4", Options: dktest.Options{PortRequired: true, ReadyFunc: isReady,
242258
Cmd: []string{"mongod", "--bind_ip_all", "--replSet", "rs0"}}},
243259
}
260+
t.Cleanup(func() {
261+
for _, spec := range transactionSpecs {
262+
t.Log("Cleaning up ", spec.ImageName)
263+
if err := spec.Cleanup(); err != nil {
264+
t.Error("Error removing ", spec.ImageName, "error:", err)
265+
}
266+
}
267+
})
268+
244269
dktesting.ParallelTest(t, transactionSpecs, func(t *testing.T, c dktest.ContainerInfo) {
245270
ip, port, err := c.FirstPort()
246271
if err != nil {

database/mysql/README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414
| `port` | | The port to bind to. |
1515
| `tls` | | TLS / SSL encrypted connection parameter; see [go-sql-driver](https://github.com/go-sql-driver/mysql#tls). Use any name (e.g. `migrate`) if you want to use a custom TLS config (`x-tls-` queries). |
1616
| `x-tls-ca` | | The location of the CA (certificate authority) file. |
17-
| `x-tls-cert` | | The location of the client certicicate file. Must be used with `x-tls-key`. |
17+
| `x-tls-cert` | | The location of the client certificate file. Must be used with `x-tls-key`. |
1818
| `x-tls-key` | | The location of the private key file. Must be used with `x-tls-cert`. |
1919
| `x-tls-insecure-skip-verify` | | Whether or not to use SSL (true\|false) |
2020

database/mysql/mysql.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -361,7 +361,7 @@ func (m *Mysql) SetVersion(version int, dirty bool) error {
361361
return &database.Error{OrigErr: err, Err: "transaction start failed"}
362362
}
363363

364-
query := "DELETE FROM `" + m.config.MigrationsTable + "`"
364+
query := "DELETE FROM `" + m.config.MigrationsTable + "` LIMIT 1"
365365
if _, err := tx.ExecContext(context.Background(), query); err != nil {
366366
if errRollback := tx.Rollback(); errRollback != nil {
367367
err = multierror.Append(err, errRollback)

0 commit comments

Comments
 (0)