summaryrefslogtreecommitdiff
path: root/vendor/github.com/uptrace/bun/query_table_create.go
diff options
context:
space:
mode:
authorLibravatar kim <89579420+NyaaaWhatsUpDoc@users.noreply.github.com>2021-09-11 12:53:44 +0100
committerLibravatar GitHub <noreply@github.com>2021-09-11 13:53:44 +0200
commitbac4ee998054a998943e9a596bfd3752d0f8a059 (patch)
tree5eed824171d7adaa407574e9ee634d93966f4e26 /vendor/github.com/uptrace/bun/query_table_create.go
parentfix broken build (#209) (diff)
downloadgotosocial-bac4ee998054a998943e9a596bfd3752d0f8a059.tar.xz
update bun library to latest commit (#206)
* update bun library to latest commit Signed-off-by: kim (grufwub) <grufwub@gmail.com> * update to latest bun release Signed-off-by: kim (grufwub) <grufwub@gmail.com>
Diffstat (limited to 'vendor/github.com/uptrace/bun/query_table_create.go')
-rw-r--r--vendor/github.com/uptrace/bun/query_table_create.go11
1 files changed, 8 insertions, 3 deletions
diff --git a/vendor/github.com/uptrace/bun/query_table_create.go b/vendor/github.com/uptrace/bun/query_table_create.go
index a5fa8e231..08c68e054 100644
--- a/vendor/github.com/uptrace/bun/query_table_create.go
+++ b/vendor/github.com/uptrace/bun/query_table_create.go
@@ -186,14 +186,20 @@ func (q *CreateTableQuery) appendUniqueConstraints(fmter schema.Formatter, b []b
sort.Strings(keys)
for _, key := range keys {
- b = q.appendUniqueConstraint(fmter, b, key, unique[key])
+ if key == "" {
+ for _, field := range unique[key] {
+ b = q.appendUniqueConstraint(fmter, b, key, field)
+ }
+ continue
+ }
+ b = q.appendUniqueConstraint(fmter, b, key, unique[key]...)
}
return b
}
func (q *CreateTableQuery) appendUniqueConstraint(
- fmter schema.Formatter, b []byte, name string, fields []*schema.Field,
+ fmter schema.Formatter, b []byte, name string, fields ...*schema.Field,
) []byte {
if name != "" {
b = append(b, ", CONSTRAINT "...)
@@ -204,7 +210,6 @@ func (q *CreateTableQuery) appendUniqueConstraint(
b = append(b, " UNIQUE ("...)
b = appendColumns(b, "", fields)
b = append(b, ")"...)
-
return b
}