code: function upgradeData(schemaVersion, dataVersion, ref, data, locals) {
    const name = isComponent(ref) ? getComponentName(ref) : getLayoutName(ref),
      dir = isComponent(ref) ? files.getComponentPath(name) : files.getLayoutPath(name), // Get the component directory
      upgradeFile = files.tryRequire(path.resolve(dir, 'upgrade')); // Grab the the upgrade.js file
  
    var transforms = [];
  
  
    log('debug', `Running upgrade for ${name}: ${ref}`);
    // If no upgrade file exists, exit early
    if (!upgradeFile) {
      log('debug', `No upgrade file found for component: ${name}`);
      return bluebird.resolve(data);
    }
  
    // find all the transforms that have to be performed (object.keys)
    transforms = aggregateTransforms(schemaVersion, dataVersion, upgradeFile);
  
    // If no transforms need to be run, exit early
    if (!transforms.length) {
      log('debug', `Upgrade tried to run, but no upgrade function was found for ${name}`, {
        component: name,
        currentVersion: dataVersion,
        schemaVersion
      });
      return bluebird.resolve(data);
    }
  
    // pass through the transform
    return runTransforms(transforms, upgradeFile, ref, data, locals)
      .then(saveTransformedData(ref))
      .catch(e => {
        throw e;
      });
  }
docs: We know a upgrade needs to happen, so let's kick it off. If
  there is no upgrade file, return early cause we can't do anything.
  
  If it exists though, we need to find which transforms to perform,
  make them happen, save that new data and then send it back
  
  @param  {Number} schemaVersion
  @param  {Number} dataVersion
  @param  {String} ref
  @param  {Object} data
  @param  {Object} locals
  @return {Promise}