code: function buildJoinRelation (join) {
      // if there is already a join on this relation then throw error
      assert.ok(!this.joinRelations[join.relation], 'join already exists for '+join.relation)
      // get relation for join
      var relation = this.model.relation(join.relation)
      // add join to joins
      this.joinRelations[join.relation] = join
      this.joinRelationNames.push(join.relation)
      // create alias for relation table to use in query
      join.relationAlias = this.newAlias(relation.model.name)
      // if join is via another model then join on that table
      if (relation.via) {
          // create alias for via table to use in query
          join.viaAlias = this.newAlias(relation.viaModel.name)
          // add join on alias table to query
          this.join.push( this.joinSql(relation.viaModel.name, join.viaAlias, relation.viaModelIdColumn, this.alias, relation.modelIdColumn, join.left ? 'LEFT JOIN' : 'JOIN') )
          // add join from alias to relation table to query
          this.join.push( this.joinSql(relation.model.name, join.relationAlias, relation.relationIdColumn, join.viaAlias, relation.viaRelationIdColumn, join.left ? 'LEFT JOIN' : 'JOIN') )
      }
      // join directly to related table
      else {
          this.join.push( this.joinSql(relation.model.name, join.relationAlias, relation.relationIdColumn, this.alias, relation.modelIdColumn, join.left ? 'LEFT JOIN' : 'JOIN') )
      }
  }
docs: @function buildJoinRelation
  
  bulid join relation - if boolean flag is true it will be LEFT JOIN
  
  @param {object} join
  
  @throws {Error}