Skip to content

Commit

Permalink
Merge pull request #218 from go-gormigrate/update-deps
Browse files Browse the repository at this point in the history
Update deps
  • Loading branch information
avakarev committed Mar 18, 2024
2 parents 56c66f9 + e2a0213 commit db7575c
Show file tree
Hide file tree
Showing 14 changed files with 155 additions and 61 deletions.
13 changes: 5 additions & 8 deletions .github/workflows/integration-test.yml
Expand Up @@ -10,29 +10,26 @@ on:

jobs:
test:
strategy:
matrix:
go: ['1.21', '1.20', '1.19', '1.18']
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v3
uses: actions/checkout@v4

- name: Lint
uses: golangci/golangci-lint-action@v3
uses: golangci/golangci-lint-action@v4
with:
version: latest
working-directory: integration-test

- name: Install Task
uses: arduino/setup-task@v1
uses: arduino/setup-task@v2
with:
repo-token: ${{ secrets.GITHUB_TOKEN }}

- name: Install Go
uses: actions/setup-go@v4
uses: actions/setup-go@v5
with:
go-version: ${{ matrix.go }}
go-version-file: integration-test/go.mod

- name: Prepare env
run: cp integration-test/.example.env integration-test/.env
Expand Down
12 changes: 8 additions & 4 deletions .github/workflows/lint.yml
Expand Up @@ -10,17 +10,21 @@ on:

jobs:
lint:
strategy:
matrix:
go: ['1.22', '1.21', '1.20', '1.19', '1.18']
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v3
uses: actions/checkout@v4

- name: Install Go
uses: actions/setup-go@v4
uses: actions/setup-go@v5
with:
go-version-file: go.mod
go-version: ${{ matrix.go }}

- name: Lint
uses: golangci/golangci-lint-action@v3
uses: golangci/golangci-lint-action@v4
with:
version: latest
args: --skip-dirs=integration-test
8 changes: 8 additions & 0 deletions CHANGELOG.md
Expand Up @@ -6,6 +6,14 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/),
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).

## [Unreleased]

## [2.1.2] - 2024-03-18
### Added
- Fix LastInsertId error in postgres driver (by @oxyno-zeta)
### Changed
- Update dependencies

## [2.1.1] - 2023-09-14
### Added
- Add to test suite pure-go sqlite implementation: github.com/glebarez/sqlite
### Changed
Expand Down
4 changes: 4 additions & 0 deletions README.md
Expand Up @@ -23,6 +23,7 @@ proper schema versioning and migration rollback support.
It supports any of the [databases Gorm supports](https://gorm.io/docs/connecting_to_the_database.html):

- MySQL
- MariaDB
- PostgreSQL
- SQLite
- Microsoft SQL Server
Expand Down Expand Up @@ -212,6 +213,9 @@ Then:
# run test for MySQL
task test:mysql

# run test for MariaDB
task test:mariadb

# run test for PostgreSQL
task test:postgres

Expand Down
8 changes: 7 additions & 1 deletion Taskfile.yml
Expand Up @@ -20,6 +20,12 @@ tasks:
- task: test
vars: {DATABASE: mysql}

test:mariadb:
desc: Run tests for MariaDB
cmds:
- task: test
vars: {DATABASE: mariadb}

test:postgres:
desc: Run tests for PostgreSQL
cmds:
Expand All @@ -46,7 +52,7 @@ tasks:

test:all:
desc: Run tests for all databases
deps: [test:mysql, test:postgres, test:sqlite, test:sqlitego, test:sqlserver]
deps: [test:mysql, test:mariadb, test:postgres, test:sqlite, test:sqlitego, test:sqlserver]

# Docker tasks

Expand Down
2 changes: 1 addition & 1 deletion go.mod
Expand Up @@ -2,7 +2,7 @@ module github.com/go-gormigrate/gormigrate/v2

go 1.18

require gorm.io/gorm v1.25.4
require gorm.io/gorm v1.25.8

require (
github.com/jinzhu/inflection v1.0.0 // indirect
Expand Down
4 changes: 2 additions & 2 deletions go.sum
Expand Up @@ -2,5 +2,5 @@ github.com/jinzhu/inflection v1.0.0 h1:K317FqzuhWc8YvSVlFMCCUb36O/S9MCKRDI7QkRKD
github.com/jinzhu/inflection v1.0.0/go.mod h1:h+uFLlag+Qp1Va5pdKtLDYj+kHp5pxUVkryuEj+Srlc=
github.com/jinzhu/now v1.1.5 h1:/o9tlHleP7gOFmsnYNz3RGnqzefHA47wQpKrrdTIwXQ=
github.com/jinzhu/now v1.1.5/go.mod h1:d3SSVoowX0Lcu0IBviAWJpolVfI5UJVZZ7cO71lE/z8=
gorm.io/gorm v1.25.4 h1:iyNd8fNAe8W9dvtlgeRI5zSVZPsq3OpcTu37cYcpCmw=
gorm.io/gorm v1.25.4/go.mod h1:L4uxeKpfBml98NYqVqwAdmV1a2nBtAec/cf3fpucW/k=
gorm.io/gorm v1.25.8 h1:WAGEZ/aEcznN4D03laj8DKnehe1e9gYQAjW8xyPRdeo=
gorm.io/gorm v1.25.8/go.mod h1:hbnx/Oo0ChWMn1BIhpy1oYozzpM15i4YPuHDmfYtwg8=
3 changes: 2 additions & 1 deletion gormigrate.go
Expand Up @@ -458,7 +458,8 @@ func (g *Gormigrate) unknownMigrationsHaveHappened() (bool, error) {
}

func (g *Gormigrate) insertMigration(id string) error {
record := map[string]interface{}{g.options.IDColumnName: id}
record := g.model()
reflect.ValueOf(record).Elem().FieldByName("ID").SetString(id)
return g.tx.Table(g.options.TableName).Create(record).Error
}

Expand Down
1 change: 1 addition & 0 deletions integration-test/.example.env
@@ -1,4 +1,5 @@
SQLITE_DSN=:memory:
POSTGRES_DSN="host=localhost user=gormigrate password=gormigrate dbname=gormigrate port=5432 sslmode=disable"
MYSQL_DSN="gormigrate:gormigrate@tcp(localhost:3306)/gormigrate?charset=utf8"
MARIADB_DSN="gormigrate:gormigrate@tcp(localhost:3307)/gormigrate?charset=utf8"
SQLSERVER_DSN="sqlserver://sa:LoremIpsum86@localhost:1433?database=master&encrypt=disable"
19 changes: 17 additions & 2 deletions integration-test/docker-compose.yml
Expand Up @@ -2,7 +2,7 @@ version: '3'

services:
postgres:
image: postgres:14-alpine
image: postgres:16-alpine
ports:
- 5432:5432
environment:
Expand All @@ -16,7 +16,7 @@ services:
retries: 10

mysql:
image: mariadb:10
image: mysql:8
ports:
- 3306:3306
environment:
Expand All @@ -30,6 +30,21 @@ services:
timeout: 3s
retries: 10

mariadb:
image: mariadb:11
ports:
- 3307:3306
environment:
MARIADB_DATABASE: gormigrate
MARIADB_ROOT_PASSWORD: gormigrate
MARIADB_USER: gormigrate
MARIADB_PASSWORD: gormigrate
healthcheck:
test: healthcheck.sh --su-mysql --connect --innodb_initialized
interval: 2s
timeout: 3s
retries: 10

sqlserver:
image: mcr.microsoft.com/mssql/server:2022-latest
ports:
Expand Down
30 changes: 16 additions & 14 deletions integration-test/go.mod
@@ -1,17 +1,19 @@
module integration-test

go 1.20
go 1.22

toolchain go1.22.1

require (
github.com/glebarez/sqlite v1.9.0
github.com/go-gormigrate/gormigrate/v2 v2.1.0
github.com/glebarez/sqlite v1.11.0
github.com/go-gormigrate/gormigrate/v2 v2.1.1
github.com/joho/godotenv v1.5.1
github.com/stretchr/testify v1.8.4
gorm.io/driver/mysql v1.5.1
gorm.io/driver/postgres v1.5.2
gorm.io/driver/sqlite v1.5.3
gorm.io/driver/sqlserver v1.5.1
gorm.io/gorm v1.25.4
github.com/stretchr/testify v1.9.0
gorm.io/driver/mysql v1.5.5
gorm.io/driver/postgres v1.5.7
gorm.io/driver/sqlite v1.5.5
gorm.io/driver/sqlserver v1.5.3
gorm.io/gorm v1.25.8
)

require (
Expand All @@ -24,19 +26,19 @@ require (
github.com/google/uuid v1.3.0 // indirect
github.com/jackc/pgpassfile v1.0.0 // indirect
github.com/jackc/pgservicefile v0.0.0-20221227161230-091c0ba34f0a // indirect
github.com/jackc/pgx/v5 v5.3.1 // indirect
github.com/jackc/pgx/v5 v5.4.3 // indirect
github.com/jinzhu/inflection v1.0.0 // indirect
github.com/jinzhu/now v1.1.5 // indirect
github.com/kr/text v0.2.0 // indirect
github.com/mattn/go-isatty v0.0.17 // indirect
github.com/mattn/go-sqlite3 v1.14.17 // indirect
github.com/microsoft/go-mssqldb v1.1.0 // indirect
github.com/microsoft/go-mssqldb v1.6.0 // indirect
github.com/pmezard/go-difflib v1.0.0 // indirect
github.com/remyoudompheng/bigfft v0.0.0-20230129092748-24d4a6f8daec // indirect
github.com/rogpeppe/go-internal v1.10.0 // indirect
golang.org/x/crypto v0.9.0 // indirect
golang.org/x/sys v0.8.0 // indirect
golang.org/x/text v0.9.0 // indirect
golang.org/x/crypto v0.14.0 // indirect
golang.org/x/sys v0.13.0 // indirect
golang.org/x/text v0.13.0 // indirect
gopkg.in/yaml.v3 v3.0.1 // indirect
modernc.org/libc v1.22.5 // indirect
modernc.org/mathutil v1.5.0 // indirect
Expand Down

0 comments on commit db7575c

Please sign in to comment.