kopparhavet/module/helpers/migration-helper.js

21 lines
912 B
JavaScript
Raw Normal View History

2020-12-01 06:30:17 +01:00
/**
* Perform a system migration for the entire World, applying migrations for Actors, Items, and Compendium packs
* @return {Promise} A Promise which resolves once the migration is completed
*/
export const migrateWorld = async function () {
ui.notifications.info(
`Applying System Migration for version ${game.system.data.version}. Please be patient and do not close your game or shut down your server.`,
{permanent: true}
);
2020-12-01 06:43:25 +01:00
// Migrate to v0.0.3 from v0.0.2 and v0.0.1
2020-12-01 06:30:17 +01:00
game.items.forEach((item) => {
2020-12-01 06:43:25 +01:00
if(item.data.type === "spell") {
2020-12-01 06:30:17 +01:00
item.update({"data.roll.label": "SPELL.ROLLTITLE"});
}
});
// Set the migration as complete
game.settings.set("kopparhavet", "worldSchemaVersion", game.system.data.version);
ui.notifications.info(`System Migration to version ${game.system.data.version} completed!`, { permanent: true });
2020-12-01 06:43:25 +01:00
};