dialect/sql: support string based pk for mysql56 indexes (prevent err… (#2506)

* dialect/sql: support string based pk for mysql56 indexes (prevent error 1071)

* Update entc/integration/customid/ent/schema/revision.go

Co-authored-by: Ariel Mashraki <7413593+a8m@users.noreply.github.com>

Co-authored-by: Ariel Mashraki <7413593+a8m@users.noreply.github.com>
This commit is contained in:
MasseElch
2022-04-29 08:57:22 +02:00
committed by GitHub
parent 4db0c544c2
commit e50d335c30
18 changed files with 2121 additions and 76 deletions

View File

@@ -736,7 +736,7 @@ func (d *MySQL) defaultSize(c *Column) int64 {
case compareVersions(version, checked) != -1:
// Column is non-unique, or not part of any index (reaching
// the error 1071).
case !c.Unique && len(c.indexes) == 0:
case !c.Unique && len(c.indexes) == 0 && !c.PrimaryKey():
default:
size = 191
}