diff --git a/packages/server/src/appMigrations/appMigrationMetadata.ts b/packages/server/src/appMigrations/appMigrationMetadata.ts index 1662a6f225..fb3310619e 100644 --- a/packages/server/src/appMigrations/appMigrationMetadata.ts +++ b/packages/server/src/appMigrations/appMigrationMetadata.ts @@ -23,16 +23,15 @@ const getCacheKey = (appId: string) => `appmigrations_${env.VERSION}_${appId}` export async function getAppMigrationVersion(appId: string): Promise { const cacheKey = getCacheKey(appId) - let metadata: AppMigrationDoc | undefined = await cache.get(cacheKey) + let version: string | undefined = await cache.get(cacheKey) // returned cached version if we found one - if (metadata?.version) { - return metadata.version + if (version) { + return version } - let version try { - metadata = await getFromDB(appId) + const metadata = await getFromDB(appId) version = metadata.version || "" } catch (err: any) { if (err.status !== 404) {