diff --git a/mssql_dialect.go b/mssql_dialect.go index ebc35164..5cd2f52b 100644 --- a/mssql_dialect.go +++ b/mssql_dialect.go @@ -62,10 +62,10 @@ func (db *mssql) SqlType(c *core.Column) string { var hasLen1 bool = (c.Length > 0) var hasLen2 bool = (c.Length2 > 0) - if hasLen1 { - res += "(" + strconv.Itoa(c.Length) + ")" - } else if hasLen2 { + if hasLen2 { res += "(" + strconv.Itoa(c.Length) + "," + strconv.Itoa(c.Length2) + ")" + } else if hasLen1 { + res += "(" + strconv.Itoa(c.Length) + ")" } return res } diff --git a/mysql_dialect.go b/mysql_dialect.go index e76830ab..4e430165 100644 --- a/mysql_dialect.go +++ b/mysql_dialect.go @@ -70,10 +70,11 @@ func (db *mysql) SqlType(c *core.Column) string { var hasLen1 bool = (c.Length > 0) var hasLen2 bool = (c.Length2 > 0) - if hasLen1 { - res += "(" + strconv.Itoa(c.Length) + ")" - } else if hasLen2 { + + if hasLen2 { res += "(" + strconv.Itoa(c.Length) + "," + strconv.Itoa(c.Length2) + ")" + } else if hasLen1 { + res += "(" + strconv.Itoa(c.Length) + ")" } return res } diff --git a/oracle_dialect.go b/oracle_dialect.go index 73300c1a..e23ab297 100644 --- a/oracle_dialect.go +++ b/oracle_dialect.go @@ -44,10 +44,10 @@ func (db *oracle) SqlType(c *core.Column) string { var hasLen1 bool = (c.Length > 0) var hasLen2 bool = (c.Length2 > 0) - if hasLen1 { - res += "(" + strconv.Itoa(c.Length) + ")" - } else if hasLen2 { + if hasLen2 { res += "(" + strconv.Itoa(c.Length) + "," + strconv.Itoa(c.Length2) + ")" + } else if hasLen1 { + res += "(" + strconv.Itoa(c.Length) + ")" } return res } diff --git a/postgres_dialect.go b/postgres_dialect.go index 58e8da4f..61e75881 100644 --- a/postgres_dialect.go +++ b/postgres_dialect.go @@ -59,10 +59,10 @@ func (db *postgres) SqlType(c *core.Column) string { var hasLen1 bool = (c.Length > 0) var hasLen2 bool = (c.Length2 > 0) - if hasLen1 { - res += "(" + strconv.Itoa(c.Length) + ")" - } else if hasLen2 { + if hasLen2 { res += "(" + strconv.Itoa(c.Length) + "," + strconv.Itoa(c.Length2) + ")" + } else if hasLen1 { + res += "(" + strconv.Itoa(c.Length) + ")" } return res }