Migrate defaultIndex attribute for config saved object (#133339)

This commit is contained in:
Joe Portner 2022-06-07 11:19:53 -04:00 committed by GitHub
parent 63d1979a68
commit d732ebec91
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
15 changed files with 395 additions and 79 deletions

View file

@ -286,3 +286,13 @@ export const migrations = {
};
```
[1] Since all `uiSettings` migrations are added to the same migration function, while not required, grouping settings by team is good practice.
### Creating Transforms
If you have need to make a change that isn't possible in a saved object migration function (for example, you need to find other saved
objects), you can create a transform function instead. This will be applied when a `config` saved object is first created, and/or when it is
first upgraded. Note that you might need to add an extra attribute to verify that this transform has already been applied so it doesn't get
applied again in the future.
For example, we needed to transform the `defaultIndex` attribute, and we added an extra `isDefaultIndexMigrated` attribute for this purpose.
See `src/core/server/ui_settings/saved_objects/transforms.ts` and [#13339](https://github.com/elastic/kibana/pull/133339) for an example.