Skip to content

Commit

Permalink
fix: gorm type is int,but MySQL create field is bigint
Browse files Browse the repository at this point in the history
  • Loading branch information
aveyuan committed Apr 18, 2024
1 parent 9d1b8d6 commit 5571d4b
Showing 1 changed file with 2 additions and 12 deletions.
14 changes: 2 additions & 12 deletions mysql.go
Original file line number Diff line number Diff line change
Expand Up @@ -477,18 +477,8 @@ func (dialector Dialector) getSchemaIntAndUnitType(field *schema.Field) string {
return sqlType
}

switch {
case field.Size <= 8:
return constraint("tinyint")
case field.Size <= 16:
return constraint("smallint")
case field.Size <= 24:
return constraint("mediumint")
case field.Size <= 32:
return constraint("int")
default:
return constraint("bigint")
}
return constraint("int")

}

func (dialector Dialector) getSchemaCustomType(field *schema.Field) string {
Expand Down

0 comments on commit 5571d4b

Please sign in to comment.