code: function runMigrations(db, currentVersion) {
    return new Promise((resolve, reject) => {
      const nextVersion = currentVersion + 1;
  
      if (!migrations[nextVersion]) {
        return resolve();
      }
  
      if (debug) {
        console.log('Migrating schema to v%d', nextVersion);
      }
      migrations[nextVersion](db)
        .then(() => {
          // write new schemaVersion file
          const json = JSON.stringify({ schemaVersion: nextVersion });
          fs.writeFile(schemaVersionFilePath, json, err => {
            if (err) {
              return reject(err);
            }
            resolve(runMigrations(db, nextVersion));
          });
        })
        .catch(reject);
    });
  }
docs: Run migrations until latest version
  @param {*} db
  @param {*} currentVersion
  @returns {Promise}