Skip to content

Commit f26bd14

Browse files
authored
Merge branch 'go-gorm:master' into bennett/deterministic-index-order
2 parents 827e2ef + 52e3b35 commit f26bd14

File tree

7 files changed

+66
-14
lines changed

7 files changed

+66
-14
lines changed

.github/release-drafter.yml

+20
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
name-template: 'v Release $NEXT_PATCH_VERSION 🌈'
2+
tag-template: 'v$NEXT_PATCH_VERSION'
3+
categories:
4+
- title: '🚀 Features'
5+
labels:
6+
- 'feature'
7+
- 'enhancement'
8+
- title: '🐛 Bug Fixes'
9+
labels:
10+
- 'fix'
11+
- 'bugfix'
12+
- 'bug'
13+
- title: '🧰 Maintenance'
14+
label: 'chore'
15+
change-template: '- $TITLE @$AUTHOR (#$NUMBER)'
16+
change-title-escapes: '\<*_&'
17+
template: |
18+
## Changes
19+
20+
$CHANGES

.github/workflows/create-release.yml

+31
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
name: Create Release
2+
3+
on:
4+
push:
5+
tags:
6+
- 'v*.*.*'
7+
8+
permissions:
9+
contents: write
10+
pull-requests: read
11+
12+
jobs:
13+
create_release:
14+
name: Create Release
15+
runs-on: ubuntu-latest
16+
17+
steps:
18+
- name: Checkout code
19+
uses: actions/checkout@v4
20+
21+
- name: Generate Release Notes and Publish
22+
id: generate_release_notes
23+
uses: release-drafter/release-drafter@v6
24+
with:
25+
config-name: 'release-drafter.yml'
26+
name: "Release ${{ github.ref_name }}"
27+
tag: ${{ github.ref_name }}
28+
publish: true
29+
prerelease: false
30+
env:
31+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

.github/workflows/tests.yml

+5-7
Original file line numberDiff line numberDiff line change
@@ -176,17 +176,15 @@ jobs:
176176

177177
services:
178178
mssql:
179-
image: mcmoe/mssqldocker:latest
179+
image: mcr.microsoft.com/mssql/server:2022-latest
180180
env:
181+
TZ: Asia/Shanghai
181182
ACCEPT_EULA: Y
182-
SA_PASSWORD: LoremIpsum86
183-
MSSQL_DB: gorm
184-
MSSQL_USER: gorm
185-
MSSQL_PASSWORD: LoremIpsum86
183+
MSSQL_SA_PASSWORD: LoremIpsum86
186184
ports:
187185
- 9930:1433
188186
options: >-
189-
--health-cmd="/opt/mssql-tools/bin/sqlcmd -S localhost -U sa -P LoremIpsum86 -l 30 -Q \"SELECT 1\" || exit 1"
187+
--health-cmd="/opt/mssql-tools18/bin/sqlcmd -S localhost -U sa -P ${MSSQL_SA_PASSWORD} -N -C -l 30 -Q \"SELECT 1\" || exit 1"
190188
--health-start-period 10s
191189
--health-interval 10s
192190
--health-timeout 5s
@@ -208,7 +206,7 @@ jobs:
208206
key: ${{ runner.os }}-go-${{ matrix.go }}-${{ hashFiles('tests/go.mod') }}
209207

210208
- name: Tests
211-
run: GITHUB_ACTION=true GORM_DIALECT=sqlserver GORM_DSN="sqlserver://gorm:LoremIpsum86@localhost:9930?database=gorm" ./tests/tests_all.sh
209+
run: GITHUB_ACTION=true GORM_DIALECT=sqlserver GORM_DSN="sqlserver://sa:LoremIpsum86@localhost:9930?database=master" ./tests/tests_all.sh
212210

213211
tidb:
214212
strategy:

gorm.go

+6
Original file line numberDiff line numberDiff line change
@@ -189,6 +189,12 @@ func Open(dialector Dialector, opts ...Option) (db *DB, err error) {
189189
_ = db.Close()
190190
}
191191
}
192+
193+
if config.TranslateError {
194+
if _, ok := db.Dialector.(ErrorTranslator); !ok {
195+
config.Logger.Warn(context.Background(), "The TranslateError option is enabled, but the Dialector %s does not implement ErrorTranslator.", db.Dialector.Name())
196+
}
197+
}
192198
}
193199

194200
if config.PrepareStmt {

tests/compose.yml

+2-5
Original file line numberDiff line numberDiff line change
@@ -18,16 +18,13 @@ services:
1818
- POSTGRES_USER=gorm
1919
- POSTGRES_PASSWORD=gorm
2020
mssql:
21-
image: '${MSSQL_IMAGE:-mcmoe/mssqldocker}:latest'
21+
image: '${MSSQL_IMAGE}:2022-latest'
2222
ports:
2323
- "127.0.0.1:9930:1433"
2424
environment:
2525
- TZ=Asia/Shanghai
2626
- ACCEPT_EULA=Y
27-
- SA_PASSWORD=LoremIpsum86
28-
- MSSQL_DB=gorm
29-
- MSSQL_USER=gorm
30-
- MSSQL_PASSWORD=LoremIpsum86
27+
- MSSQL_SA_PASSWORD=LoremIpsum86
3128
tidb:
3229
image: 'pingcap/tidb:v6.5.0'
3330
ports:

tests/tests_all.sh

+1-1
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ if [[ -z $GITHUB_ACTION ]]; then
2727
SQLCMDPASSWORD=LoremIpsum86 sqlcmd -U sa -S localhost:9930 -Q "IF SUSER_ID (N'gorm') IS NULL CREATE LOGIN gorm WITH PASSWORD = 'LoremIpsum86';" > /dev/null || true
2828
SQLCMDPASSWORD=LoremIpsum86 sqlcmd -U sa -S localhost:9930 -Q "IF USER_ID (N'gorm') IS NULL CREATE USER gorm FROM LOGIN gorm; ALTER SERVER ROLE sysadmin ADD MEMBER [gorm];" > /dev/null || true
2929
else
30-
docker compose up -d
30+
MSSQL_IMAGE=mcr.microsoft.com/mssql/server docker compose up -d
3131
fi
3232
cd ..
3333
fi

tests/tests_test.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ var DB *gorm.DB
2020
var (
2121
mysqlDSN = "gorm:gorm@tcp(localhost:9910)/gorm?charset=utf8&parseTime=True&loc=Local"
2222
postgresDSN = "user=gorm password=gorm dbname=gorm host=localhost port=9920 sslmode=disable TimeZone=Asia/Shanghai"
23-
sqlserverDSN = "sqlserver://gorm:LoremIpsum86@localhost:9930?database=gorm"
23+
sqlserverDSN = "sqlserver://sa:LoremIpsum86@localhost:9930?database=master"
2424
tidbDSN = "root:@tcp(localhost:9940)/test?charset=utf8&parseTime=True&loc=Local"
2525
)
2626

0 commit comments

Comments
 (0)