diff --git a/dialect_mysql.go b/dialect_mysql.go index 5dda6f5d..af4dd3b2 100644 --- a/dialect_mysql.go +++ b/dialect_mysql.go @@ -157,9 +157,10 @@ func (m *mysql) FizzTranslator() fizz.Translator { func (m *mysql) DumpSchema(w io.Writer) error { deets := m.Details() - cmd := exec.Command("mysqldump", "-d", "-h", deets.Host, "-P", deets.Port, "-u", deets.User, fmt.Sprintf("--password=%s", deets.Password), deets.Database) + // 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) if deets.Port == "socket" { - cmd = exec.Command("mysqldump", "-d", "-S", deets.Host, "-u", deets.User, fmt.Sprintf("--password=%s", deets.Password), deets.Database) + cmd = exec.Command("mysqldump", "--column-statistics=0", "-d", "-S", deets.Host, "-u", deets.User, fmt.Sprintf("--password=%s", deets.Password), deets.Database) } return genericDumpSchema(deets, cmd, w) } diff --git a/slices/map.go b/slices/map.go index c99e8a13..7f04eeee 100644 --- a/slices/map.go +++ b/slices/map.go @@ -19,6 +19,8 @@ func (m Map) Interface() interface{} { func (m *Map) Scan(src interface{}) error { var b []byte switch t := src.(type) { + case nil: + return nil case []byte: b = t case string: diff --git a/slices/map_test.go b/slices/map_test.go index 265d9940..f18dc418 100644 --- a/slices/map_test.go +++ b/slices/map_test.go @@ -35,3 +35,18 @@ func Test_Map_UnMarshalJSON_uninitialized_map_does_not_panic(t *testing.T) { r.Len(maps, 1) }) } + +func Test_Map_Scan(t *testing.T) { + r := require.New(t) + in := []byte(`{"a":"b"}`) + m := Map{} + r.NoError(m.Scan(in)) + r.Equal("b", m["a"]) +} + +func Test_Map_Null_Scan(t *testing.T) { + r := require.New(t) + m := Map{} + r.NoError(m.Scan(nil)) + r.Equal(Map{}, m) +}