diff --git a/query_gen/mysql.go b/query_gen/mysql.go index 41ccb996..80fab7ab 100644 --- a/query_gen/mysql.go +++ b/query_gen/mysql.go @@ -123,10 +123,14 @@ func (a *MysqlAdapter) CreateTable(name, table, charset, collation string, colum q += "," } else { q += "(" - for _, column := range strings.Split(key.Columns, ",") { - q += "`" + column + "`," + for i, column := range strings.Split(key.Columns, ",") { + if i != 0 { + q += ",`" + column + "`" + } else { + q += "`" + column + "`" + } } - q = q[0:len(q)-1] + ")," + q += ")," } } } @@ -167,9 +171,6 @@ func (a *MysqlAdapter) ChangeColumn(name, table, colName string, col DBTableColu } func (a *MysqlAdapter) SetDefaultColumn(name, table, colName, colType, defaultStr string) (string, error) { - if colType == "text" { - return "", errors.New("text fields cannot have default values") - } if defaultStr == "" { defaultStr = "''" } @@ -799,10 +800,10 @@ func (a *MysqlAdapter) buildFlexiWhereSb(sb *strings.Builder, where string, date sb.WriteString(dateCutoff.Unit) sb.WriteString(") AND UTC_TIMESTAMP()") case 11: - sb.WriteString(" < UTC_TIMESTAMP()-interval ? ") + sb.WriteString("