diff --git a/x-pack/plugins/fleet/server/saved_objects/index.ts b/x-pack/plugins/fleet/server/saved_objects/index.ts index f0b51b19dda33..e8fda952f17e6 100644 --- a/x-pack/plugins/fleet/server/saved_objects/index.ts +++ b/x-pack/plugins/fleet/server/saved_objects/index.ts @@ -44,7 +44,7 @@ import { } from './migrations/to_v7_13_0'; import { migratePackagePolicyToV7140, migrateInstallationToV7140 } from './migrations/to_v7_14_0'; import { migratePackagePolicyToV7150 } from './migrations/to_v7_15_0'; -import { migrateInstallationToV7160 } from './migrations/to_v7_16_0'; +import { migrateInstallationToV7160, migratePackagePolicyToV7160 } from './migrations/to_v7_16_0'; /* * Saved object types and mappings @@ -294,6 +294,7 @@ const getSavedObjectTypes = ( '7.13.0': migratePackagePolicyToV7130, '7.14.0': migratePackagePolicyToV7140, '7.15.0': migratePackagePolicyToV7150, + '7.16.0': migratePackagePolicyToV7160, }, }, [PACKAGES_SAVED_OBJECT_TYPE]: { diff --git a/x-pack/plugins/fleet/server/saved_objects/migrations/to_v7_16_0.ts b/x-pack/plugins/fleet/server/saved_objects/migrations/to_v7_16_0.ts index 7d12c550ec406..b69523434408b 100644 --- a/x-pack/plugins/fleet/server/saved_objects/migrations/to_v7_16_0.ts +++ b/x-pack/plugins/fleet/server/saved_objects/migrations/to_v7_16_0.ts @@ -7,9 +7,11 @@ import type { SavedObjectMigrationFn } from 'kibana/server'; -import type { Installation } from '../../../common'; +import type { Installation, PackagePolicy } from '../../../common'; import { AUTO_UPDATE_PACKAGES, DEFAULT_PACKAGES } from '../../../common'; +import { migratePackagePolicyToV7160 as SecSolMigratePackagePolicyToV7160 } from './security_solution'; + export const migrateInstallationToV7160: SavedObjectMigrationFn = ( installationDoc, migrationContext @@ -26,3 +28,17 @@ export const migrateInstallationToV7160: SavedObjectMigrationFn = ( + packagePolicyDoc, + migrationContext +) => { + let updatedPackagePolicyDoc = packagePolicyDoc; + + // Endpoint specific migrations + if (packagePolicyDoc.attributes.package?.name === 'endpoint') { + updatedPackagePolicyDoc = SecSolMigratePackagePolicyToV7160(packagePolicyDoc, migrationContext); + } + + return updatedPackagePolicyDoc; +};