Correct AUTO_INCREMENT for Uint64 and Int64

This commit is contained in:
Seth Shelnutt 2016-05-06 09:08:17 -04:00
parent 2061731e2e
commit f83842b48e

View File

@ -39,9 +39,11 @@ func (sqlite3) DataTypeOf(field *StructField) string {
case reflect.Int64, reflect.Uint64: case reflect.Int64, reflect.Uint64:
sqlType = "bigint" sqlType = "bigint"
if field.IsPrimaryKey { if field.IsPrimaryKey {
field.TagSettings["AUTO_INCREMENT"] = "AUTO_INCREMENT" if _, ok := field.TagSettings["AUTO_INCREMENT"]; ok {
sqlType = "integer primary key autoincrement" sqlType = "integer primary key autoincrement"
} else { } else {
sqlType += "integer primary key"
}
} }
case reflect.Float32, reflect.Float64: case reflect.Float32, reflect.Float64:
sqlType = "real" sqlType = "real"