Skip to content

Commit

Permalink
properly check duplicates between columns and related entities
Browse files Browse the repository at this point in the history
  • Loading branch information
RFSH committed Oct 21, 2023
1 parent e31f847 commit 939279d
Showing 1 changed file with 9 additions and 7 deletions.
16 changes: 9 additions & 7 deletions js/reference.js
Original file line number Diff line number Diff line change
Expand Up @@ -2578,15 +2578,12 @@

for(var i = 0; i < visibleFKs.length; i++) {
fkr = visibleFKs[i];
// if in the visible columns list
if (currentColumns[fkr.name]) {
continue;
}

var relatedRef, fkName;
if (fkr.isPath) {
// since we're sure that the pseudoColumn either going to be
// general pseudoColumn or InboundForeignKeyPseudoColumn then it will have reference
this._related.push(module._createPseudoColumn(this, fkr.sourceObjectWrapper, tuple).reference);
relatedRef = module._createPseudoColumn(this, fkr.sourceObjectWrapper, tuple).reference;
fkName = relatedRef.pseudoColumn.name;
} else {
fkr = fkr.foreignKey;

Expand All @@ -2595,9 +2592,14 @@
fkr._table._baseTable === this._table && fkr._table._altForeignKey === fkr) {
continue;
}
relatedRef = this._generateRelatedReference(fkr, tuple, true);
fkName = _sourceColumnHelpers.generateForeignKeyName(fkr, true);
}

this._related.push(this._generateRelatedReference(fkr, tuple, true));
if (currentColumns[fkName]) {
continue;
}
this._related.push(relatedRef);
}

if (notSorted && this._related.length !== 0) {
Expand Down

0 comments on commit 939279d

Please sign in to comment.