Fixed migration

pull/2/head
Erebus 2020-12-01 06:43:25 +01:00
parent d94636bbe6
commit 14a77c37b9
3 changed files with 7 additions and 9 deletions

View File

@ -8,11 +8,9 @@ export const migrateWorld = async function () {
{permanent: true} {permanent: true}
); );
console.log(game.system.data.version) // Migrate to v0.0.3 from v0.0.2 and v0.0.1
game.items.forEach((item) => { game.items.forEach((item) => {
// Migrate to v0.1 from v0.0.1 and v0.0.1 if(item.data.type === "spell") {
if (item.data.type === "spell") {
item.update({"data.roll.label": "SPELL.ROLLTITLE"}); item.update({"data.roll.label": "SPELL.ROLLTITLE"});
} }
}); });
@ -20,4 +18,4 @@ export const migrateWorld = async function () {
// Set the migration as complete // Set the migration as complete
game.settings.set("kopparhavet", "worldSchemaVersion", game.system.data.version); game.settings.set("kopparhavet", "worldSchemaVersion", game.system.data.version);
ui.notifications.info(`System Migration to version ${game.system.data.version} completed!`, { permanent: true }); ui.notifications.info(`System Migration to version ${game.system.data.version} completed!`, { permanent: true });
} };

View File

@ -21,7 +21,7 @@ Hooks.once("init", () => {
scope: "world", scope: "world",
config: true, config: true,
default: 0, default: 0,
type: Number, type: String,
}); });
game.settings.register("kopparhavet", "gameSystem", { game.settings.register("kopparhavet", "gameSystem", {
name: "Game System", name: "Game System",
@ -180,8 +180,8 @@ function registerHandlebarsHelpers() {
function migrateWorld() { function migrateWorld() {
// Determine whether a system migration is required and feasible // Determine whether a system migration is required and feasible
const currentVersion = game.settings.get("kopparhavet", "worldSchemaVersion"); const currentVersion = game.settings.get("kopparhavet", "worldSchemaVersion");
const NEEDS_MIGRATION_VERSION = 0.1; const NEEDS_MIGRATION_VERSION = "0.0.3";
const COMPATIBLE_MIGRATION_VERSION = 0; const COMPATIBLE_MIGRATION_VERSION = '0' || isNaN('NaN');
let needMigration = currentVersion < NEEDS_MIGRATION_VERSION || currentVersion === null; let needMigration = currentVersion < NEEDS_MIGRATION_VERSION || currentVersion === null;
// Perform the migration // Perform the migration

View File

@ -2,7 +2,7 @@
"name": "kopparhavet", "name": "kopparhavet",
"title": "Kopparhavets Hjältar", "title": "Kopparhavets Hjältar",
"description": "The Molten Sea is a dangerous but exciting place, where pirates, sorcerers and secretive orders of knighthood struggle for power, wealth and ancient lore.", "description": "The Molten Sea is a dangerous but exciting place, where pirates, sorcerers and secretive orders of knighthood struggle for power, wealth and ancient lore.",
"version": "0.1", "version": "0.0.3",
"minimumCoreVersion": "0.7.5", "minimumCoreVersion": "0.7.5",
"compatibleCoreVersion": "0.7.7", "compatibleCoreVersion": "0.7.7",
"templateVersion": 4, "templateVersion": 4,