Fixing BOOL type to UNSIGNED in MySQL instances.
This commit is contained in:
parent
57c72125b3
commit
50657fb5cf
@ -30,7 +30,7 @@ func (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