Skip to content

Commit

Permalink
Fix postgres tests
Browse files Browse the repository at this point in the history
  • Loading branch information
jinzhu committed Aug 11, 2017
1 parent 969ab67 commit d61b7db
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions model_struct.go
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,11 @@ func (structField *StructField) clone() *StructField {
TagSettings: map[string]string{},
Struct: structField.Struct,
IsForeignKey: structField.IsForeignKey,
Relationship: structField.Relationship,
}

if structField.Relationship != nil {
relationship := *structField.Relationship
clone.Relationship = &relationship
}

for key, value := range structField.TagSettings {
Expand Down Expand Up @@ -222,7 +226,9 @@ func (scope *Scope) GetModelStruct() *ModelStruct {

if subField.Relationship != nil && subField.Relationship.JoinTableHandler != nil {
if joinTableHandler, ok := subField.Relationship.JoinTableHandler.(*JoinTableHandler); ok {
joinTableHandler.Setup(subField.Relationship, joinTableHandler.TableName, reflectType, joinTableHandler.Destination.ModelType)
newJoinTableHandler := &JoinTableHandler{}
newJoinTableHandler.Setup(subField.Relationship, joinTableHandler.TableName, reflectType, joinTableHandler.Destination.ModelType)
subField.Relationship.JoinTableHandler = newJoinTableHandler
}
}

Expand Down

0 comments on commit d61b7db

Please sign in to comment.