Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix arm64 sqlcmd installation #613

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -2,3 +2,5 @@ gorm
go.sum
.*
*.db
go-sqlcmd
sqlcmd
17 changes: 16 additions & 1 deletion test.sh
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,22 @@ if [[ -z $GITHUB_ACTION ]]; then
if [[ $(uname -a) == *" arm64" ]]; then
MSSQL_IMAGE=mcr.microsoft.com/azure-sql-edge docker-compose up --detach --quiet-pull || true
echo "starting"
go install github.com/microsoft/go-sqlcmd/cmd/sqlcmd@latest || true
if [[ $(which sqlcmd) == "" ]] && ! [ -x "./sqlcmd" ]; then
echo "sqlcmd not found; installing"
git clone --depth 1 https://github.com/microsoft/go-sqlcmd || true
cd go-sqlcmd
go build -o ../sqlcmd ./cmd/modern
cd ..
sqlcmd() {
"./sqlcmd" "$@"
}
else
if [ -x "./sqlcmd" ] ; then
sqlcmd() {
"./sqlcmd" "$@"
}
fi
fi
SQLCMDPASSWORD=LoremIpsum86 sqlcmd -U sa -S localhost:9930 -Q "IF DB_ID('gorm') IS NULL CREATE DATABASE gorm" > /dev/null || true
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
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
Expand Down