Skip to content

Instantly share code, notes, and snippets.

@nicksherron
Last active September 21, 2021 05:58
Show Gist options
  • Select an option

  • Save nicksherron/e27df3999dc09b6f59689bd6a5e1803f to your computer and use it in GitHub Desktop.

Select an option

Save nicksherron/e27df3999dc09b6f59689bd6a5e1803f to your computer and use it in GitHub Desktop.
#!/usr/bin/env zsh
echo "installing tbls"
brew install k1LoW/tap/tbls
echo "brew install mysql"
brew install mysql
brew services start mysql
$(brew --prefix mysql)/bin/mysqladmin -u root password p@ssw0rd
brew services stop mysql
echo "starting mysql homebrew service"
brew services start mysql
cd ~/go/src/github.com/acenda/${1}
echo "running ${1} tests"
mysql -uroot -pp@ssw0rd -e "drop database org_target"
export ASTUR_GOLANG_COMMON_MYSQL_DSN="root:p@ssw0rd@tcp(127.0.0.1:3306)/astur?charset=utf8mb4&parseTime=True"
go test ./...
unset ASTUR_GOLANG_COMMON_MYSQL_DSN
cat << EOF > .tbls.yml
dsn: mysql://root:p%40ssw0rd@127.0.0.1:3306/org_target
docPath: docs/schema
EOF
echo "creating schema docs in directory docs/schema"
mkdir -p docs/schema
tbls doc
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment