Skip to content

Commit

Permalink
dialect/sql: support string based pk for mysql56 indexes (prevent err… (
Browse files Browse the repository at this point in the history
#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>
  • Loading branch information
masseelch and a8m committed Apr 29, 2022
1 parent 4db0c54 commit e50d335
Show file tree
Hide file tree
Showing 18 changed files with 2,121 additions and 76 deletions.
2 changes: 1 addition & 1 deletion dialect/sql/schema/mysql.go
Expand Up @@ -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
}
Expand Down
157 changes: 127 additions & 30 deletions entc/integration/customid/ent/client.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

27 changes: 14 additions & 13 deletions entc/integration/customid/ent/config.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

28 changes: 15 additions & 13 deletions entc/integration/customid/ent/ent.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit e50d335

Please sign in to comment.