Skip to content

Commit d6166ab

Browse files
committed
resolved upstream conflicts in go.*
2 parents c441785 + 856ea12 commit d6166ab

File tree

76 files changed

+2618
-673
lines changed

Some content is hidden

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

76 files changed

+2618
-673
lines changed

.github/workflows/ci.yaml

Lines changed: 20 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -6,22 +6,27 @@ on:
66

77
jobs:
88
lint:
9+
name: lint
910
runs-on: ubuntu-latest
1011
steps:
11-
- uses: actions/checkout@v2
12-
12+
- uses: actions/setup-go@v3
13+
with:
14+
go-version: "1.20.x"
15+
- uses: actions/checkout@v3
1316
- name: golangci-lint
14-
uses: golangci/golangci-lint-action@v2
17+
uses: golangci/golangci-lint-action@v3
18+
with:
19+
version: latest
1520

1621
test:
1722
runs-on: ubuntu-latest
1823
strategy:
1924
matrix:
20-
go: ["1.17.x", "1.18.x"]
25+
go: ["1.19.x", "1.20.x"]
2126
steps:
22-
- uses: actions/checkout@v2
27+
- uses: actions/checkout@v3
2328

24-
- uses: actions/setup-go@v2
29+
- uses: actions/setup-go@v3
2530
with:
2631
go-version: ${{ matrix.go }}
2732

@@ -55,15 +60,15 @@ jobs:
5560
# 3. When the workflow is triggered by a tag with `v` prefix
5661
if: ${{ success() && github.repository == 'golang-migrate/migrate' && startsWith(github.ref, 'refs/tags/v') }}
5762
steps:
58-
- uses: actions/checkout@v2
63+
- uses: actions/checkout@v3
5964
with:
6065
fetch-depth: 0
6166
- uses: ruby/setup-ruby@v1
6267
with:
6368
ruby-version: 2.7
64-
- uses: actions/setup-go@v2
69+
- uses: actions/setup-go@v3
6570
with:
66-
go-version: "1.18.x"
71+
go-version: "1.19.x"
6772

6873
- uses: docker/setup-qemu-action@v1
6974
- uses: docker/setup-buildx-action@v1
@@ -89,9 +94,15 @@ jobs:
8994
- run: package_cloud push golang-migrate/migrate/ubuntu/focal dist/migrate.linux-amd64.deb
9095
env:
9196
PACKAGECLOUD_TOKEN: ${{ secrets.PACKAGECLOUD_TOKEN }}
97+
- run: package_cloud push golang-migrate/migrate/ubuntu/jammy dist/migrate.linux-amd64.deb
98+
env:
99+
PACKAGECLOUD_TOKEN: ${{ secrets.PACKAGECLOUD_TOKEN }}
92100
- run: package_cloud push golang-migrate/migrate/debian/buster dist/migrate.linux-amd64.deb
93101
env:
94102
PACKAGECLOUD_TOKEN: ${{ secrets.PACKAGECLOUD_TOKEN }}
95103
- run: package_cloud push golang-migrate/migrate/debian/bullseye dist/migrate.linux-amd64.deb
96104
env:
97105
PACKAGECLOUD_TOKEN: ${{ secrets.PACKAGECLOUD_TOKEN }}
106+
- run: package_cloud push golang-migrate/migrate/debian/bookworm dist/migrate.linux-amd64.deb
107+
env:
108+
PACKAGECLOUD_TOKEN: ${{ secrets.PACKAGECLOUD_TOKEN }}

.goreleaser.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -87,6 +87,7 @@ release:
8787
prerelease: auto
8888
source:
8989
enabled: true
90+
rlcp: true
9091
format: zip
9192
changelog:
9293
skip: false

Dockerfile.github-actions

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,4 +8,4 @@ RUN ln -s /usr/local/bin/migrate /usr/bin/migrate
88
RUN ln -s /usr/local/bin/migrate /migrate
99

1010
ENTRYPOINT ["migrate"]
11-
CMD ["--help"]
11+
CMD ["--help"]

GETTING_STARTED.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
# Getting started
22
Before you start, you should understand the concept of forward/up and reverse/down database migrations.
33

4-
Configure a database for your application. Make sure that your database driver is supported [here](README.md#databases)
4+
Configure a database for your application. Make sure that your database driver is supported [here](README.md#databases).
55

66
## Create migrations
77
Create some migrations using migrate CLI. Here is an example:
@@ -10,7 +10,7 @@ migrate create -ext sql -dir db/migrations -seq create_users_table
1010
```
1111
Once you create your files, you should fill them.
1212

13-
**IMPORTANT:** In a project developed by more than one person there is a chance of migrations inconsistency - e.g. two developers can create conflicting migrations, and the developer that created his migration later gets it merged to the repository first.
13+
**IMPORTANT:** In a project developed by more than one person there is a chance of migrations inconsistency - e.g. two developers can create conflicting migrations, and the developer that created their migration later gets it merged to the repository first.
1414
Developers and Teams should keep an eye on such cases (especially during code review).
1515
[Here](https://github.com/golang-migrate/migrate/issues/179#issuecomment-475821264) is the issue summary if you would like to read more.
1616

@@ -30,7 +30,7 @@ Just add the code to your app and you're ready to go!
3030

3131
Before commiting your migrations you should run your migrations up, down, and then up again to see if migrations are working properly both ways.
3232
(e.g. if you created a table in a migration but reverse migration did not delete it, you will encounter an error when running the forward migration again)
33-
It's also worth checking your migrations in a separate, containerized environment. You can find some tools in the end of this document.
33+
It's also worth checking your migrations in a separate, containerized environment. You can find some tools at the [end of this document](#further-reading).
3434

3535
**IMPORTANT:** If you would like to run multiple instances of your app on different machines be sure to use a database that supports locking when running migrations. Otherwise you may encounter issues.
3636

Makefile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
SOURCE ?= file go_bindata github github_ee bitbucket aws_s3 google_cloud_storage godoc_vfs gitlab
2-
DATABASE ?= postgres mysql redshift cassandra spanner cockroachdb clickhouse mongodb sqlserver firebird neo4j pgx
2+
DATABASE ?= postgres mysql redshift cassandra spanner cockroachdb yugabytedb clickhouse mongodb sqlserver firebird neo4j pgx pgx5
33
DATABASE_TEST ?= $(DATABASE) sqlite sqlite3 sqlcipher
44
BUILD_NUMBER ?= 0
55
VERSION ?= $(shell git describe --tags --long --dirty=-unsupported 2>/dev/null | cut -c 2-)-j$(BUILD_NUMBER)

README.md

Lines changed: 12 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
1-
[![GitHub Workflow Status (branch)](https://img.shields.io/github/workflow/status/golang-migrate/migrate/CI/master)](https://github.com/golang-migrate/migrate/actions/workflows/ci.yaml?query=branch%3Amaster)
1+
[![GitHub Workflow Status (branch)](https://img.shields.io/github/actions/workflow/status/golang-migrate/migrate/ci.yaml?branch=master)](https://github.com/golang-migrate/migrate/actions/workflows/ci.yaml?query=branch%3Amaster)
22
[![GoDoc](https://pkg.go.dev/badge/github.com/golang-migrate/migrate)](https://pkg.go.dev/github.com/golang-migrate/migrate/v4)
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.17%2C%201.18-lightgrey.svg)
6+
![Supported Go Versions](https://img.shields.io/badge/Go-1.19%2C%201.20-lightgrey.svg)
77
[![GitHub Release](https://img.shields.io/github/release/golang-migrate/migrate.svg)](https://github.com/golang-migrate/migrate/releases)
8-
[![Go Report Card](https://goreportcard.com/badge/github.com/golang-migrate/migrate)](https://goreportcard.com/report/github.com/golang-migrate/migrate)
8+
[![Go Report Card](https://goreportcard.com/badge/github.com/golang-migrate/migrate/v4)](https://goreportcard.com/report/github.com/golang-migrate/migrate/v4)
99

1010
# migrate
1111

@@ -24,7 +24,8 @@ Forked from [mattes/migrate](https://github.com/mattes/migrate)
2424
Database drivers run migrations. [Add a new database?](database/driver.go)
2525

2626
* [PostgreSQL](database/postgres)
27-
* [PGX](database/pgx)
27+
* [PGX v4](database/pgx)
28+
* [PGX v5](database/pgx/v5)
2829
* [Redshift](database/redshift)
2930
* [Ql](database/ql)
3031
* [Cassandra](database/cassandra)
@@ -38,6 +39,7 @@ Database drivers run migrations. [Add a new database?](database/driver.go)
3839
* [Shell](database/shell) ([todo #171](https://github.com/mattes/migrate/issues/171))
3940
* [Google Cloud Spanner](database/spanner)
4041
* [CockroachDB](database/cockroachdb)
42+
* [YugabyteDB](database/yugabytedb)
4143
* [ClickHouse](database/clickhouse)
4244
* [Firebird](database/firebird)
4345
* [MS SQL Server](database/sqlserver)
@@ -108,7 +110,7 @@ $ docker run -v {{ migration dir }}:/migrations --network host migrate/migrate
108110
* Uses `io.Reader` streams internally for low memory overhead.
109111
* Thread-safe and no goroutine leaks.
110112

111-
__[Go Documentation](https://godoc.org/github.com/golang-migrate/migrate)__
113+
__[Go Documentation](https://pkg.go.dev/github.com/golang-migrate/migrate/v4)__
112114

113115
```go
114116
import (
@@ -168,6 +170,11 @@ Each migration has an up and down migration. [Why?](FAQ.md#why-two-separate-file
168170

169171
[Best practices: How to write migrations.](MIGRATIONS.md)
170172

173+
## Coming from another db migration tool?
174+
175+
Check out [migradaptor](https://github.com/musinit/migradaptor/).
176+
*Note: migradaptor is not affliated or supported by this project*
177+
171178
## Versions
172179

173180
Version | Supported? | Import | Notes

SECURITY.md

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
# Security Policy
2+
3+
## Supported Versions
4+
5+
| Version | Supported |
6+
| ------- | ------------------ |
7+
| master | :white_check_mark: |
8+
| 4.x | :white_check_mark: |
9+
| 3.x | :x: |
10+
| < 3.0 | :x: |
11+
12+
## Reporting a Vulnerability
13+
14+
We prefer [coordinated disclosures](https://en.wikipedia.org/wiki/Coordinated_vulnerability_disclosure). To start one, create a GitHub security advisory following [these instructions](https://docs.github.com/en/code-security/security-advisories/guidance-on-reporting-and-writing/privately-reporting-a-security-vulnerability)
15+
16+
Please suggest potential impact and urgency in your reports.

cmd/migrate/README.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
[Release Downloads](https://github.com/golang-migrate/migrate/releases)
88

99
```bash
10-
$ curl -L https://github.com/golang-migrate/migrate/releases/download/$version/migrate.$platform-amd64.tar.gz | tar xvz
10+
$ curl -L https://github.com/golang-migrate/migrate/releases/download/$version/migrate.$os-$arch.tar.gz | tar xvz
1111
```
1212

1313
### MacOS
@@ -63,7 +63,7 @@ $ go install -tags 'postgres' github.com/golang-migrate/migrate/v4/cmd/migrate@l
6363
to build the cli for use with other databases, replace the `postgres` build tag
6464
with the appropriate database tag(s) for the databases desired. The tags
6565
correspond to the names of the sub-packages underneath the
66-
[`database`](../database) package.
66+
[`database`](../../database) package.
6767
1. Similarly to the database build tags, if you need to support other sources, use the appropriate build tag(s).
6868
1. Support for build constraints will be removed in the future: https://github.com/golang-migrate/migrate/issues/60
6969
1. For versions of Go 1.15 and lower, [make sure](https://github.com/golang-migrate/migrate/pull/257#issuecomment-705249902) you're not installing the `migrate` CLI from a module. e.g. there should not be any `go.mod` files in your current directory or any directory from your current directory to the root
@@ -127,7 +127,7 @@ $ migrate -database "$MY_MIGRATE_DATABASE"
127127
Check out https://stedolan.github.io/jq/
128128

129129
```bash
130-
$ migrate -database "$(cat config.json | jq '.database')"
130+
$ migrate -database "$(cat config.json | jq -r '.database')"
131131
```
132132

133133
### YAML files

database/cassandra/cassandra.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,14 +3,14 @@ package cassandra
33
import (
44
"errors"
55
"fmt"
6-
"go.uber.org/atomic"
76
"io"
8-
"io/ioutil"
97
nurl "net/url"
108
"strconv"
119
"strings"
1210
"time"
1311

12+
"go.uber.org/atomic"
13+
1414
"github.com/gocql/gocql"
1515
"github.com/golang-migrate/migrate/v4/database"
1616
"github.com/golang-migrate/migrate/v4/database/multistmt"
@@ -231,7 +231,7 @@ func (c *Cassandra) Run(migration io.Reader) error {
231231
return err
232232
}
233233

234-
migr, err := ioutil.ReadAll(migration)
234+
migr, err := io.ReadAll(migration)
235235
if err != nil {
236236
return err
237237
}

database/clickhouse/README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# ClickHouse
22

3-
`clickhouse://username:password@host:port/database=clicks?x-multi-statement=true`
3+
`clickhouse://host:port?username=user&password=password&database=clicks&x-multi-statement=true`
44

55
| URL Query | Description |
66
|------------|-------------|

0 commit comments

Comments
 (0)