Skip to content

Instantly share code, notes, and snippets.

@lukas1994
Created August 26, 2015 22:50
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save lukas1994/7db26a33d564034bdeb5 to your computer and use it in GitHub Desktop.
Save lukas1994/7db26a33d564034bdeb5 to your computer and use it in GitHub Desktop.
migrate localeIdentifier field in Parse _Installation to new format
Parse.Cloud.job("localeIdentifierMigration", function(request, status) {
var modify = function(old) {
return old.replace(/_/g, "-").split("@")[0];
};
Parse.Cloud.useMasterKey();
var query = new Parse.Query("_Installation");
query.each(function(installation) {
var old = installation.get("localeIdentifier");
if (old) {
installation.set("localeIdentifier", modify(old));
}
return installation.save();
}).then(function() {
status.success("Migration completed successfully.");
}, function(error) {
status.error("Something went wrong.");
});
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment