diff --git a/src/core/server/ui_settings/saved_objects/migrations.ts b/src/core/server/ui_settings/saved_objects/migrations.ts index 3688686a8f5973..16f217352b99a7 100644 --- a/src/core/server/ui_settings/saved_objects/migrations.ts +++ b/src/core/server/ui_settings/saved_objects/migrations.ts @@ -10,18 +10,29 @@ import { SavedObjectUnsanitizedDoc, SavedObjectSanitizedDoc } from 'kibana/serve export const migrations = { '7.9.0': (doc: SavedObjectUnsanitizedDoc): SavedObjectSanitizedDoc => ({ + ...doc, + ...(doc.attributes && { + attributes: Object.keys(doc.attributes).reduce( + (acc, key) => + key.startsWith('siem:') + ? { + ...acc, + [key.replace('siem', 'securitySolution')]: doc.attributes[key], + } + : { + ...acc, + [key]: doc.attributes[key], + }, + {} + ), + }), + references: doc.references || [], + }), + '7.12.0': (doc: SavedObjectUnsanitizedDoc): SavedObjectSanitizedDoc => ({ ...doc, ...(doc.attributes && { attributes: Object.keys(doc.attributes).reduce((acc, key) => { - if (key.startsWith('siem:')) { - return { - ...acc, - [key.replace('siem', 'securitySolution')]: doc.attributes[key], - }; - } else if ( - key === 'timepicker:quickRanges' && - doc.attributes[key].indexOf('section') > -1 - ) { + if (key === 'timepicker:quickRanges' && doc.attributes[key].indexOf('section') > -1) { const ranges = JSON.parse(doc.attributes[key]).map( ({ from, to, display }: { from: string; to: string; display: string }) => { return {