Skip to content

Commit

Permalink
removed mysqldump option --column-statistics to make it compatible
Browse files Browse the repository at this point in the history
  • Loading branch information
sio4 committed Sep 24, 2022
1 parent 9d766fd commit 98751a9
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 3 deletions.
6 changes: 6 additions & 0 deletions .github/workflows/tests.yml
Expand Up @@ -32,6 +32,12 @@ jobs:
with:
go-version: ${{ matrix.go-version }}

- name: Setup MySQL environment
run: |
mysqldump --version
echo $HOME
echo -e "[mysqldump]\ncolumn-statistics=0" > $HOME/.my.cnf
- name: Build and run soda
env:
SODA_DIALECT: "mysql"
Expand Down
5 changes: 2 additions & 3 deletions dialect_mysql.go
Expand Up @@ -192,10 +192,9 @@ func (m *mysql) FizzTranslator() fizz.Translator {

func (m *mysql) DumpSchema(w io.Writer) error {
deets := m.Details()
// Github CI is currently using mysql:5.7 but the mysqldump version doesn't seem to match
cmd := exec.Command("mysqldump", "--column-statistics=0", "-d", "-h", deets.Host, "-P", deets.Port, "-u", deets.User, fmt.Sprintf("--password=%s", deets.Password), deets.Database)
cmd := exec.Command("mysqldump", "-d", "-h", deets.Host, "-P", deets.Port, "-u", deets.User, fmt.Sprintf("--password=%s", deets.Password), deets.Database)
if deets.Port == "socket" {
cmd = exec.Command("mysqldump", "--column-statistics=0", "-d", "-S", deets.Host, "-u", deets.User, fmt.Sprintf("--password=%s", deets.Password), deets.Database)
cmd = exec.Command("mysqldump", "-d", "-S", deets.Host, "-u", deets.User, fmt.Sprintf("--password=%s", deets.Password), deets.Database)
}
return genericDumpSchema(deets, cmd, w)
}
Expand Down

0 comments on commit 98751a9

Please sign in to comment.