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

Update README.md #2

Merged
merged 7 commits into from
Mar 4, 2024
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Next Next commit
Update README.md
  • Loading branch information
alex-dixon authored Mar 2, 2024
commit b11de9b89717d8ac4f55b80855c4f7549d78cfdb
19 changes: 16 additions & 3 deletions packages/migrate/README.md
Original file line number Diff line number Diff line change
@@ -66,6 +66,19 @@ migration will not happen. If this happens to you, redeploying the current versi
annotation that allows migration from this state is unlikely to trigger
nondeterminism. As a best practice, handle invoke errors by transition the machine to a state that is migratory.

complete
before migrating unless they are
specifically
### Migration function
The migration function takes the previous workflow's data and returns the new workflow data. It is defined as part of the new workflow code and deployed with the new workflow.

You may not need a migration function for most deployments. Some cases where you will:

#### A state in the previous workflow doesn't exist in the new one.
This will happen when you rename a state or remove it.

#### You messed up the shape of the machine context.
Suppose you save something to the workflow context and it got past the type checker and your tests. You can easily deploy a migration function that takes the old context and rewrites it to the shape the rest of tour program expects.

#### You want to recalculate a running timer based on arbitrary logic.
You can return the timers the new machine will have as a function of the previous timers, context, and state. The framework will set them for you.

If you want to cancel a timer, simply omit it from the return value of the migration function.

Loading