From ad4188862eeaab30fc7c48d3224b5a786557aec5 Mon Sep 17 00:00:00 2001 From: Wiky Lyu Date: Sat, 4 Mar 2023 16:12:56 +0800 Subject: [PATCH] fix: incorrect table relationship panic message #791 --- schema/table.go | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/schema/table.go b/schema/table.go index ed8c517c1..9eb7d1bfe 100644 --- a/schema/table.go +++ b/schema/table.go @@ -534,7 +534,7 @@ func (t *Table) belongsToRelation(field *Field) *Relation { } else { panic(fmt.Errorf( "bun: %s belongs-to %s: %s must have column %s", - t.TypeName, field.GoName, t.TypeName, baseColumn, + t.TypeName, field.GoName, joinTable.TypeName, joinColumn, )) } } @@ -588,7 +588,7 @@ func (t *Table) hasOneRelation(field *Field) *Relation { } else { panic(fmt.Errorf( "bun: %s has-one %s: %s must have column %s", - field.GoName, t.TypeName, joinTable.TypeName, baseColumn, + field.GoName, t.TypeName, t.TypeName, baseColumn, )) } @@ -598,7 +598,7 @@ func (t *Table) hasOneRelation(field *Field) *Relation { } else { panic(fmt.Errorf( "bun: %s has-one %s: %s must have column %s", - field.GoName, t.TypeName, joinTable.TypeName, baseColumn, + field.GoName, t.TypeName, joinTable.TypeName, joinColumn, )) } } @@ -677,7 +677,7 @@ func (t *Table) hasManyRelation(field *Field) *Relation { } else { panic(fmt.Errorf( "bun: %s has-many %s: %s must have column %s", - t.TypeName, field.GoName, t.TypeName, baseColumn, + t.TypeName, field.GoName, joinTable.TypeName, joinColumn, )) } }