summaryrefslogtreecommitdiff
path: root/vendor/github.com/uptrace/bun/schema/table.go
diff options
context:
space:
mode:
authorLibravatar tobi <31960611+tsmethurst@users.noreply.github.com>2021-09-23 11:13:28 +0200
committerLibravatar GitHub <noreply@github.com>2021-09-23 11:13:28 +0200
commit142f37f1bd0291f74e12002931d05174f3a31741 (patch)
treed2e5d80df32a0217a442cfd9ba207d5e88879b77 /vendor/github.com/uptrace/bun/schema/table.go
parentupdate media processing (#244) (diff)
downloadgotosocial-142f37f1bd0291f74e12002931d05174f3a31741.tar.xz
upstep bun version (#243)
Diffstat (limited to 'vendor/github.com/uptrace/bun/schema/table.go')
-rw-r--r--vendor/github.com/uptrace/bun/schema/table.go18
1 files changed, 9 insertions, 9 deletions
diff --git a/vendor/github.com/uptrace/bun/schema/table.go b/vendor/github.com/uptrace/bun/schema/table.go
index 8bed5ed38..213f821ab 100644
--- a/vendor/github.com/uptrace/bun/schema/table.go
+++ b/vendor/github.com/uptrace/bun/schema/table.go
@@ -181,17 +181,17 @@ func (t *Table) initFields() {
t.FieldMap = make(map[string]*Field, t.Type.NumField())
t.addFields(t.Type, nil)
- if len(t.PKs) > 0 {
- return
- }
- for _, name := range []string{"id", "uuid", "pk_" + t.ModelName} {
- if field, ok := t.FieldMap[name]; ok {
- field.markAsPK()
- t.PKs = []*Field{field}
- t.DataFields = removeField(t.DataFields, field)
- break
+ if len(t.PKs) == 0 {
+ for _, name := range []string{"id", "uuid", "pk_" + t.ModelName} {
+ if field, ok := t.FieldMap[name]; ok {
+ field.markAsPK()
+ t.PKs = []*Field{field}
+ t.DataFields = removeField(t.DataFields, field)
+ break
+ }
}
}
+
if len(t.PKs) == 1 {
pk := t.PKs[0]
if pk.SQLDefault != "" {