Begin working on the migration script upon world load for Actors
This commit is contained in:
parent
8f8da244c0
commit
14f76e0a27
6 changed files with 192 additions and 1 deletions
24
module/migrations/checkMigrations.mjs
Normal file
24
module/migrations/checkMigrations.mjs
Normal file
|
|
@ -0,0 +1,24 @@
|
|||
import { __ID__ } from "../consts.mjs";
|
||||
import { Logger } from "../utils/Logger.mjs";
|
||||
import { migrateTo3_0_0 } from "./v3.0.0.mjs";
|
||||
|
||||
const { isNewerVersion } = foundry.utils;
|
||||
|
||||
export async function checkMigrations() {
|
||||
if (!game.user.isActiveGM) {
|
||||
Logger.debug(`User not active GM, skipping data migrations`);
|
||||
return;
|
||||
};
|
||||
|
||||
const migrationVersion = game.settings.get(__ID__, `migrationVersion`);
|
||||
let updateVersion = !migrationVersion;
|
||||
|
||||
if (isNewerVersion("3.0.0", migrationVersion)) {
|
||||
await migrateTo3_0_0();
|
||||
updateVersion = true;
|
||||
};
|
||||
|
||||
if (updateVersion) {
|
||||
game.settings.set(__ID__, `migrationVersion`, game.system.version);
|
||||
};
|
||||
};
|
||||
Loading…
Add table
Add a link
Reference in a new issue