mirror of
https://github.com/superseriousbusiness/gotosocial.git
synced 2025-03-10 15:48:52 +01:00
[bugfix] Fix length for type varchar must be at least 1
on Postgres (#3885)
This commit is contained in:
parent
98c4cae89a
commit
35e94c8abd
1 changed files with 8 additions and 3 deletions
|
@ -253,10 +253,15 @@ func getBunColumnDef(db bun.IDB, rtype reflect.Type, fieldName string) (string,
|
||||||
} else {
|
} else {
|
||||||
buf = append(buf, sqltype.VarChar...)
|
buf = append(buf, sqltype.VarChar...)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Only specify varchar length for dialects
|
||||||
|
// where specifying VARCHAR length is mandatory.
|
||||||
|
if dvl := d.DefaultVarcharLen(); dvl != 0 {
|
||||||
buf = append(buf, "("...)
|
buf = append(buf, "("...)
|
||||||
buf = strconv.AppendInt(buf, int64(d.DefaultVarcharLen()), 10)
|
buf = strconv.AppendInt(buf, int64(dvl), 10)
|
||||||
buf = append(buf, ")"...)
|
buf = append(buf, ")"...)
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// Append not null definition if field requires.
|
// Append not null definition if field requires.
|
||||||
if field.NotNull && d.Name() != dialect.Oracle {
|
if field.NotNull && d.Name() != dialect.Oracle {
|
||||||
|
|
Loading…
Reference in a new issue