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
…or 1071)
  • Loading branch information
masseelch committed Apr 28, 2022
1 parent 4db0c54 commit 00eb91d
Show file tree
Hide file tree
Showing 18 changed files with 2,119 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 00eb91d

Please sign in to comment.