Fixed migration

This commit is contained in:
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}
);
console.log(game.system.data.version)
// Migrate to v0.0.3 from v0.0.2 and v0.0.1
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"});
}
});
@@ -20,4 +18,4 @@ export const migrateWorld = async function () {
// 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 });
}
};

View File

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