-
Notifications
You must be signed in to change notification settings - Fork 8.5k
Description
The current implementation relies on the persistor of embeddable state to use getMigration (on PersistableStateDefinition) and getMigrationVersions (from EmbeddableFactory I believe) together to run migrations correctly (otherwise the plugin author won't know what version number to pass into the getMigration function).
The getMigration and getAllMigrationVersions should be replaced with a single getMigrations function on PersistableStateService interfaces that returns an object with the versions mapped to the functions. This will make it easier for consumers.
Additional persistable state items tracked in other issues:
- Add a tested example plugin that uses these services to showcase to consumers how it is meant to be used with Saved Object mgirations. ([PersistableState] Embeddable example plugin that uses persistable state services #102771)
- Improve Embeddable migration unit tests ([PersistableState] Improve unit test coverage of embeddable migrations #102772)
- Add a tutorial in our Developer Guide called "Persistable state" that walks through 1. how to persist persistable state (call the migrations, inject/extract, etc), and 2. How to implement persistable state (write migrations for any state change). ([PersistableState] Improve documentation for how to use persistable state services #103105)
I'm adding this as critical impact because of the impact this will have on users of PersistableStateService. This change should result in improved upgrade stability, by making it less fragile to use in an incorrect manner.