RFC: Use provided type to create the dstTable rather than inferring from the SQL types #1872
17
engine.go
17
engine.go
|
@ -448,21 +448,6 @@ func formatColumnValue(dstDialect dialects.Dialect, d interface{}, col *schemas.
|
|||
return "NULL"
|
||||
}
|
||||
|
||||
if dstDialect.URI().DBType == schemas.SQLITE || dstDialect.URI().DBType == schemas.MSSQL {
|
||||
if dq, ok := d.(bool); ok {
|
||||
if dq {
|
||||
return "1"
|
||||
}
|
||||
return "0"
|
||||
}
|
||||
if val, ok := d.(reflect.Value); ok && val.Kind() == reflect.Bool {
|
||||
if val.Bool() {
|
||||
return "1"
|
||||
}
|
||||
return "0"
|
||||
}
|
||||
}
|
||||
|
||||
if dq, ok := d.(bool); ok && (dstDialect.URI().DBType == schemas.SQLITE ||
|
||||
dstDialect.URI().DBType == schemas.MSSQL) {
|
||||
if dq {
|
||||
|
@ -637,7 +622,7 @@ func (engine *Engine) dumpTables(tables []*schemas.Table, w io.Writer, tp ...sch
|
|||
if col == nil {
|
||||
return errors.New("unknown column error")
|
||||
}
|
||||
temp += "," + formatColumnValue(dstDialect, val.Elem().FieldByName(col.FieldName), col)
|
||||
temp += "," + formatColumnValue(dstDialect, val.Elem().FieldByName(col.FieldName).Interface(), col)
|
||||
}
|
||||
_, err = io.WriteString(w, temp[1:]+");\n")
|
||||
if err != nil {
|
||||
|
|
Loading…
Reference in New Issue
Block a user