Make migrations async

This commit is contained in:
Mo Bitar
2019-01-10 12:35:46 -06:00
parent 42ec6ee9bb
commit 3f055f5672
3 changed files with 12 additions and 7 deletions

View File

@@ -21,7 +21,7 @@ class MigrationManager extends SFMigrationManager {
return {
name: "editor-to-component",
content_type: "SN|Editor",
handler: (editors) => {
handler: async (editors) => {
// Convert editors to components
for(var editor of editors) {
// If there's already a component for this url, then skip this editor
@@ -60,7 +60,8 @@ class MigrationManager extends SFMigrationManager {
return {
name: "component-url-to-hosted-url",
content_type: "SN|Component",
handler: (components) => {
handler: async (components) => {
let hasChanges = false;
var notes = this.modelManager.validItemsForContentType("Note");
for(var note of notes) {
for(var component of components) {
@@ -69,10 +70,14 @@ class MigrationManager extends SFMigrationManager {
note.setDomainDataItem(component.uuid, clientData, ComponentManager.ClientDataDomain);
note.setDomainDataItem(component.hosted_url, null, ComponentManager.ClientDataDomain);
note.setDirty(true, true); // dont update client date
hasChanges = true;
}
}
}
this.syncManager.sync();
if(hasChanges) {
this.syncManager.sync();
}
}
}
}

6
package-lock.json generated
View File

@@ -8097,9 +8097,9 @@
"dev": true
},
"standard-file-js": {
"version": "0.3.22",
"resolved": "https://registry.npmjs.org/standard-file-js/-/standard-file-js-0.3.22.tgz",
"integrity": "sha512-nezAUHLX0K0DVtdofrWv2wuznXD8xPJLC/F/usGqtxvtqWbpH+MG99WtHidOd3D38qlGY7PER1nRbFT0WbA92w==",
"version": "0.3.31",
"resolved": "https://registry.npmjs.org/standard-file-js/-/standard-file-js-0.3.31.tgz",
"integrity": "sha512-flbgmQWrLJQ2TAv+RZkVG23akePixAqekAvG8yNEyueR5E/Fdtgm2LFEbg2sFf+ko/qR0vqWgq95cgUdTejRQA==",
"dev": true
},
"static-extend": {

View File

@@ -45,7 +45,7 @@
"serve-static": "^1.13.2",
"sn-models": "0.1.9",
"sn-stylekit": "2.0.13",
"standard-file-js": "0.3.22",
"standard-file-js": "0.3.31",
"grunt-shell": "^2.1.0"
}
}