Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(migration): enable automatic data migrations between versions #245

Draft
wants to merge 7 commits into
base: release-0.3.0
Choose a base branch
from

Conversation

NoahJGersh
Copy link
Contributor

@NoahJGersh NoahJGersh commented Feb 13, 2025

Type
What type of pull request is this? (e.g., Bug fix, Feature, Refactor, etc.)

  • Bug fix
  • Feature
  • Refactor
  • Other (please describe):

Description
This PR establishes an automatic method for performing data migrations, for cases where breaking changes are introduced to the model between versions. It automatically checks for all migrations between the last known system version in the given world and the new version of the system, and attempts to convert the previous data to the known schema from that version.

To-Do List

  • Implement further migrations for the data shift between 0.2.2 and 0.3.0
  • Verify stability of existing migration (0.2 -> 0.3)
  • Test using actual release versions

Related Issue
Closes #244

How Has This Been Tested?

  1. Manually set the previous game version setting (`game.settings.set('cosmere-rpg', 'latestVersion', '0.2.2')
  2. Refresh Foundry
  3. Confirm that the correct migration version, and a success message, are logged to the console

Checklist:

  • I have commented on my code, particularly in hard-to-understand areas.
  • My changes do not introduce any new warnings or errors.
  • My PR does not contain any copyrighted works that I do not have permission to use.
  • I have tested my changes on Foundry VTT version: [insert version here].

Additional Context:
The bulk of this PR is based on Stan's blueprint. It has largely been updated to be type-safe and functional with the latest changes to the data model, especially following the changes to talent trees.

Copy link
Contributor

@zithith zithith left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think I'll leave the Talent Tree sign-off to @stanavdb, though to me it looks about right.

But one other point (plus my comment on the character migration script): Do we want to add a method to call this manually from somewhere? may not be one for implementing this ticket, but food for thought...

// ),
// );
// }

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Also needs a level value change, previously it was typed as string I think? but now that the advancement is in it's a number.

Can see examples of this with the B9 pregens

@zithith zithith linked an issue Feb 22, 2025 that may be closed by this pull request
1 task
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Add support for data migrations
2 participants