Merge 50657fb5cf91b0286331f3e6648f465d5c568c23 into 45ccb134373e7d9fa76d5987a6fed6cd5a5adfd4
This commit is contained in:
commit
cb71d838bc
@ -41,7 +41,7 @@ func (s *mysql) DataTypeOf(field *StructField) string {
|
|||||||
if sqlType == "" {
|
if sqlType == "" {
|
||||||
switch dataValue.Kind() {
|
switch dataValue.Kind() {
|
||||||
case reflect.Bool:
|
case reflect.Bool:
|
||||||
sqlType = "boolean"
|
sqlType = "tinyint(1) unsigned" // NOTE: "boolean" does not set as UNSIGNED by default.
|
||||||
case reflect.Int, reflect.Int8, reflect.Int16, reflect.Int32:
|
case reflect.Int, reflect.Int8, reflect.Int16, reflect.Int32:
|
||||||
if _, ok := field.TagSettings["AUTO_INCREMENT"]; ok || field.IsPrimaryKey {
|
if _, ok := field.TagSettings["AUTO_INCREMENT"]; ok || field.IsPrimaryKey {
|
||||||
field.TagSettings["AUTO_INCREMENT"] = "AUTO_INCREMENT"
|
field.TagSettings["AUTO_INCREMENT"] = "AUTO_INCREMENT"
|
||||||
|
Loading…
x
Reference in New Issue
Block a user