mirror of https://github.com/go-gorm/gorm.git
Fix docker-compose test env for Mac M1
This commit is contained in:
parent
8c3673286d
commit
8d293d44dd
|
@ -2,7 +2,7 @@ version: '3'
|
|||
|
||||
services:
|
||||
mysql:
|
||||
image: 'mysql:latest'
|
||||
image: 'mysql/mysql-server:latest'
|
||||
ports:
|
||||
- 9910:3306
|
||||
environment:
|
||||
|
@ -20,7 +20,7 @@ services:
|
|||
- POSTGRES_USER=gorm
|
||||
- POSTGRES_PASSWORD=gorm
|
||||
mssql:
|
||||
image: 'mcmoe/mssqldocker:latest'
|
||||
image: '${MSSQL_IMAGE:-mcmoe/mssqldocker}:latest'
|
||||
ports:
|
||||
- 9930:1433
|
||||
environment:
|
||||
|
|
|
@ -8,13 +8,13 @@ require (
|
|||
github.com/jackc/pgx/v4 v4.14.1 // indirect
|
||||
github.com/jinzhu/now v1.1.4
|
||||
github.com/lib/pq v1.10.4
|
||||
github.com/mattn/go-sqlite3 v1.14.10 // indirect
|
||||
golang.org/x/crypto v0.0.0-20220126234351-aa10faf2a1f8 // indirect
|
||||
github.com/mattn/go-sqlite3 v1.14.11 // indirect
|
||||
golang.org/x/crypto v0.0.0-20220128200615-198e4374d7ed // indirect
|
||||
gorm.io/driver/mysql v1.2.3
|
||||
gorm.io/driver/postgres v1.2.3
|
||||
gorm.io/driver/sqlite v1.2.6
|
||||
gorm.io/driver/sqlserver v1.2.1
|
||||
gorm.io/gorm v1.22.4
|
||||
gorm.io/gorm v1.22.5
|
||||
)
|
||||
|
||||
replace gorm.io/gorm => ../
|
||||
|
|
|
@ -15,6 +15,23 @@ then
|
|||
cd ..
|
||||
fi
|
||||
|
||||
# SqlServer for Mac M1
|
||||
if [ -d tests ]
|
||||
then
|
||||
cd tests
|
||||
if [[ $(uname -a) == *" arm64" ]]; then
|
||||
MSSQL_IMAGE=mcr.microsoft.com/azure-sql-edge docker-compose start
|
||||
go install github.com/microsoft/go-sqlcmd/cmd/sqlcmd@latest
|
||||
SQLCMDPASSWORD=LoremIpsum86 sqlcmd -U sa -S localhost:9930 -Q "IF DB_ID('gorm') IS NULL CREATE DATABASE gorm" > /dev/null
|
||||
SQLCMDPASSWORD=LoremIpsum86 sqlcmd -U sa -S localhost:9930 -Q "IF SUSER_ID (N'gorm') IS NULL CREATE LOGIN gorm WITH PASSWORD = 'LoremIpsum86';" > /dev/null
|
||||
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
|
||||
else
|
||||
docker-compose start
|
||||
fi
|
||||
cd ..
|
||||
fi
|
||||
|
||||
|
||||
for dialect in "${dialects[@]}" ; do
|
||||
if [ "$GORM_DIALECT" = "" ] || [ "$GORM_DIALECT" = "${dialect}" ]
|
||||
then
|
||||
|
|
|
@ -62,13 +62,14 @@ func OpenTestConnection() (db *gorm.DB, err error) {
|
|||
PreferSimpleProtocol: true,
|
||||
}), &gorm.Config{})
|
||||
case "sqlserver":
|
||||
// CREATE LOGIN gorm WITH PASSWORD = 'LoremIpsum86';
|
||||
// go install github.com/microsoft/go-sqlcmd/cmd/sqlcmd@latest
|
||||
// SQLCMDPASSWORD=LoremIpsum86 sqlcmd -U sa -S localhost:9930
|
||||
// CREATE DATABASE gorm;
|
||||
// USE gorm;
|
||||
// GO
|
||||
// CREATE LOGIN gorm WITH PASSWORD = 'LoremIpsum86';
|
||||
// CREATE USER gorm FROM LOGIN gorm;
|
||||
// sp_changedbowner 'gorm';
|
||||
// npm install -g sql-cli
|
||||
// mssql -u gorm -p LoremIpsum86 -d gorm -o 9930
|
||||
// ALTER SERVER ROLE sysadmin ADD MEMBER [gorm];
|
||||
// GO
|
||||
log.Println("testing sqlserver...")
|
||||
if dbDSN == "" {
|
||||
dbDSN = "sqlserver://gorm:LoremIpsum86@localhost:9930?database=gorm"
|
||||
|
|
Loading…
Reference in New Issue