Fix the foreign key definition
This commit is contained in:
parent
409d256e47
commit
2a15bb917a
|
@ -1251,12 +1251,12 @@ DataSource.prototype.idNames = function (modelName) {
|
|||
*/
|
||||
DataSource.prototype.defineForeignKey = function defineForeignKey(className, key, foreignClassName) {
|
||||
// quit if key already defined
|
||||
if (this.definitions[className].properties[key]) return;
|
||||
if (this.definitions[className].rawProperties[key]) return;
|
||||
|
||||
if (this.connector.defineForeignKey) {
|
||||
var cb = function (err, keyType) {
|
||||
if (err) throw err;
|
||||
this.definitions[className].properties[key] = {type: keyType};
|
||||
this.definitions[className].defineProperty(key, {type: keyType});
|
||||
}.bind(this);
|
||||
switch (this.connector.defineForeignKey.length) {
|
||||
case 4:
|
||||
|
@ -1268,7 +1268,7 @@ DataSource.prototype.defineForeignKey = function defineForeignKey(className, key
|
|||
break;
|
||||
}
|
||||
} else {
|
||||
this.definitions[className].properties[key] = {type: Number};
|
||||
this.definitions[className].defineProperty(key, {type: Number});
|
||||
}
|
||||
|
||||
this.models[className].registerProperty(key);
|
||||
|
|
Loading…
Reference in New Issue