mirror of
https://github.com/superseriousbusiness/gotosocial
synced 2025-06-05 21:59:39 +02:00
[bugfix] Fix length for type varchar must be at least 1
on Postgres (#3885)
This commit is contained in:
@@ -253,9 +253,14 @@ func getBunColumnDef(db bun.IDB, rtype reflect.Type, fieldName string) (string,
|
|||||||
} else {
|
} else {
|
||||||
buf = append(buf, sqltype.VarChar...)
|
buf = append(buf, sqltype.VarChar...)
|
||||||
}
|
}
|
||||||
buf = append(buf, "("...)
|
|
||||||
buf = strconv.AppendInt(buf, int64(d.DefaultVarcharLen()), 10)
|
// Only specify varchar length for dialects
|
||||||
buf = append(buf, ")"...)
|
// where specifying VARCHAR length is mandatory.
|
||||||
|
if dvl := d.DefaultVarcharLen(); dvl != 0 {
|
||||||
|
buf = append(buf, "("...)
|
||||||
|
buf = strconv.AppendInt(buf, int64(dvl), 10)
|
||||||
|
buf = append(buf, ")"...)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Append not null definition if field requires.
|
// Append not null definition if field requires.
|
||||||
|
Reference in New Issue
Block a user