utf8mb4 encoding (#7959)

* use utf8mb4 character set for connections to mysql

* use utf8mb4 character set for tables, shorten varchar fields used in unique indexes

* migration type to update table character set

* update table character sets

* set charset for temp_user.status

* gofmt
This commit is contained in:
Dan Cech
2017-03-28 14:34:53 +02:00
committed by Torkel Ödegaard
parent e91a078105
commit 24d4e50343
19 changed files with 198 additions and 22 deletions
@@ -3,6 +3,7 @@ package migrator
import (
"fmt"
"strconv"
"strings"
)
type Postgres struct {
@@ -112,3 +113,13 @@ func (db *Postgres) DropIndexSql(tableName string, index *Index) string {
idxName := index.XName(tableName)
return fmt.Sprintf("DROP INDEX %v", quote(idxName))
}
func (db *Postgres) UpdateTableSql(tableName string, columns []*Column) string {
var statements = []string{}
for _, col := range columns {
statements = append(statements, "ALTER "+db.QuoteStr()+col.Name+db.QuoteStr()+" TYPE "+db.SqlType(col))
}
return "ALTER TABLE " + db.Quote(tableName) + " " + strings.Join(statements, ", ") + ";"
}