ent/migrate: correctly handle column collation change

Summary: In addition coulmn description on create / alter table to use 'CHARACTER SET' keyword instead of 'CHARSET' per mysql docs (https://dev.mysql.com/doc/refman/5.7/en/charset-column.html)

Reviewed By: a8m

Differential Revision: D17090725

fbshipit-source-id: d0f53a547ff8d68f2b2b54af96ef5b86f60f74b4
This commit is contained in:
Alex Snast
2019-08-28 02:14:19 -07:00
committed by Facebook Github Bot
parent 9207ab5bb1
commit 011e6d24ae
3 changed files with 4 additions and 4 deletions

View File

@@ -198,7 +198,7 @@ func (c *Column) PrimaryKey() bool { return c.Key == PrimaryKey }
func (c *Column) MySQL(version string) *sql.ColumnBuilder {
b := sql.Column(c.Name).Type(c.MySQLType(version)).Attr(c.Attr)
if c.Charset != "" {
b.Attr("CHARSET " + c.Charset)
b.Attr("CHARACTER SET " + c.Charset)
}
c.unique(b)
if c.Increment {