diff options
author | 2024-01-15 14:08:07 +0100 | |
---|---|---|
committer | 2024-01-15 14:08:07 +0100 | |
commit | 6433a505820cfeb43990a3453a0ed8b24e432b7d (patch) | |
tree | 3f968a63d6a77991df95fde88ee0f08727f26eb6 /vendor/github.com/uptrace/bun/schema/relation.go | |
parent | [chore]: Bump github.com/tdewolff/minify/v2 from 2.20.12 to 2.20.14 (#2530) (diff) | |
download | gotosocial-6433a505820cfeb43990a3453a0ed8b24e432b7d.tar.xz |
[chore] update bun + extras v1.1.16 -> v1.1.17 (#2534)
Diffstat (limited to 'vendor/github.com/uptrace/bun/schema/relation.go')
-rw-r--r-- | vendor/github.com/uptrace/bun/schema/relation.go | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/vendor/github.com/uptrace/bun/schema/relation.go b/vendor/github.com/uptrace/bun/schema/relation.go index 6636e26a6..9eb74f7e9 100644 --- a/vendor/github.com/uptrace/bun/schema/relation.go +++ b/vendor/github.com/uptrace/bun/schema/relation.go @@ -30,6 +30,12 @@ type Relation struct { M2MJoinFields []*Field } +// References returns true if the table to which the Relation belongs needs to declare a foreign key constraint to create the relation. +// For other relations, the constraint is created in either the referencing table (1:N, 'has-many' relations) or a mapping table (N:N, 'm2m' relations). +func (r *Relation) References() bool { + return r.Type == HasOneRelation || r.Type == BelongsToRelation +} + func (r *Relation) String() string { return fmt.Sprintf("relation=%s", r.Field.GoName) } |