From 5aa13af368f57c348f502fe9b4d4bd7c22402a4c Mon Sep 17 00:00:00 2001 From: Michael Hudson Nkotagu Date: Fri, 22 Nov 2024 13:34:01 +0300 Subject: [PATCH] Update apps/civicsignalblog/migrations/20241122_054517_migration.ts Co-authored-by: Clemence Kyara --- .../migrations/20241122_054517_migration.ts | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/apps/civicsignalblog/migrations/20241122_054517_migration.ts b/apps/civicsignalblog/migrations/20241122_054517_migration.ts index f866d76a1..6061f2afa 100644 --- a/apps/civicsignalblog/migrations/20241122_054517_migration.ts +++ b/apps/civicsignalblog/migrations/20241122_054517_migration.ts @@ -32,12 +32,8 @@ export async function up({ payload }: MigrateUpArgs): Promise { } try { - newGlobalConfig = { - ...existingGlobalConfig, - globalType: newGlobalConfigType, - }; - - delete newGlobalConfig._id; + const { _id, globalType, ...newGlobalConfig } = existingOldConfig; + newGlobalConfig.globalType = newGlobalConfigType; await db.collection("globals").insertOne(newGlobalConfig); payload.logger.info( `✓ Successfully migrated global config [${oldGlobalConfigType}] to [${newGlobalConfigType}]`,