joinClauses(knex) {
      const joinTable = this.joinTable();

      if (this.type === 'belongsTo' || this.type === 'belongsToMany') {
        const targetKey = this.type === 'belongsTo' ? this.key('foreignKey') : this.key('otherKey');

        knex.join(joinTable, joinTable + '.' + targetKey, '=', this.targetTableName + '.' + this.targetIdAttribute);

        // A `belongsTo` -> `through` is currently the only relation with two joins.
        if (this.type === 'belongsTo') {
          knex.join(
            this.parentTableName,
            joinTable + '.' + this.throughIdAttribute,
            '=',
            this.parentTableName + '.' + this.key('throughForeignKey')
          );
        }
      } else {
        knex.join(
          joinTable,
          joinTable + '.' + this.throughIdAttribute,
          '=',
          this.targetTableName + '.' + this.key('throughForeignKey')
        );
      }
    }
Generates the join clauses necessary for the current relation.

@param {Knex} knex Knex instance.
@return {undefined}