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 0450c3a
Show file tree
Hide file tree
Showing 24 changed files with 3,091 additions and 1 deletion.
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
217 changes: 217 additions & 0 deletions entc/integration/migrate/key/client.go

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

63 changes: 63 additions & 0 deletions entc/integration/migrate/key/config.go

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

37 changes: 37 additions & 0 deletions entc/integration/migrate/key/context.go

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

0 comments on commit 0450c3a

Please sign in to comment.