add relation equality check to avoid skipping self-referential schemas
This commit is contained in:
		
							parent
							
								
									8efabf38d1
								
							
						
					
					
						commit
						a56aa16473
					
				@ -519,7 +519,7 @@ func (rel *Relationship) ParseConstraint() *Constraint {
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
	if rel.Type == BelongsTo {
 | 
						if rel.Type == BelongsTo {
 | 
				
			||||||
		for _, r := range rel.FieldSchema.Relationships.Relations {
 | 
							for _, r := range rel.FieldSchema.Relationships.Relations {
 | 
				
			||||||
			if r.FieldSchema == rel.Schema && len(rel.References) == len(r.References) {
 | 
								if r != rel && r.FieldSchema == rel.Schema && len(rel.References) == len(r.References) {
 | 
				
			||||||
				matched := true
 | 
									matched := true
 | 
				
			||||||
				for idx, ref := range r.References {
 | 
									for idx, ref := range r.References {
 | 
				
			||||||
					if !(rel.References[idx].PrimaryKey == ref.PrimaryKey && rel.References[idx].ForeignKey == ref.ForeignKey &&
 | 
										if !(rel.References[idx].PrimaryKey == ref.PrimaryKey && rel.References[idx].ForeignKey == ref.ForeignKey &&
 | 
				
			||||||
 | 
				
			|||||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user