template/sequelize4/index.js
function defineRelation(modelName, relationType, targetModelName, options) {
    if (debug) {
        fs.writeSync(debugFD, modelName + '.' + relationType + '(' + targetModelName + ', ' + util.inspect(options, {depth: null}) + ');\n\n');
    }

    models[modelName][relationType](models[targetModelName], options); // account.hasMany(contact, {...})
}
function defineRelation(modelName, relationType, targetModelName, options) {
    if (debug) {
        fs.writeSync(debugFD, modelName + '.' + relationType + '(' + targetModelName + ', ' + util.inspect(options, {depth: null}) + ');\n\n');
    }

    models[modelName][relationType](models[targetModelName], options); // account.hasMany(contact, {...})
}
function defineRelation ( modelName , relationType , targetModelName , options ) { if ( debug ) { fs . writeSync ( debugFD , modelName + '.' + relationType + '(' + targetModelName + ', ' + util . inspect ( options , { depth : null } ) + ');\n\n' ) ; } models [ modelName ] [ relationType ] ( models [ targetModelName ] , options ) ; // account.hasMany(contact, {...}) }
Define 'hasMany' and 'belongsTo' relations.
@private
@param {string} modelName - Name of the model
@param {string} relationType - Type of the relation 'hasMany' or 'belongsTo'
@param {string} targetModelName - Name of the target model which this relation related to.
@param {Object} options - Sequelize options of relation.
Define hasMany and belongsTo relations .