不要怂,就是干,撸起袖子干!

Commit 91b84530 by Joel Trost Committed by Matt Broadstone

test/associations/alias.js pass

1 parent b2b4fa9b
Showing with 8 additions and 4 deletions
...@@ -528,12 +528,16 @@ module.exports = { ...@@ -528,12 +528,16 @@ module.exports = {
} }
} }
var associationType = include.association.associationType; var associationType = include.association.associationType;
var rootKey = primaryKey; var rootKey,joinKey;
console.log(include.association);
var joinKey = quoteIdentifier(include.association.foreignKey);
if(associationType === 'BelongsTo'){ if(associationType === 'BelongsTo'){
rootKey = quoteIdentifier(include.association.foreignKey); rootKey = quoteIdentifier(include.association.foreignKey);
joinKey = primaryKey; joinKey = primaryKey;
}else if (associationType === 'HasMany'){
rootKey = primaryKey;
joinKey = quoteIdentifier(include.association.identifier);
}else{
rootKey = primaryKey;
joinKey = quoteIdentifier(include.association.foreignKey);
} }
var joinType = include.required ? 'INNER JOIN' : 'LEFT OUTER JOIN'; var joinType = include.required ? 'INNER JOIN' : 'LEFT OUTER JOIN';
...@@ -559,7 +563,7 @@ module.exports = { ...@@ -559,7 +563,7 @@ module.exports = {
var val = where[key]; var val = where[key];
var operator = '='; var operator = '=';
if (val == 'NULL') { if (val === 'NULL') {
operator = 'IS'; operator = 'IS';
} }
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!