Merge pull request #13905 from Budibase/fix/app-migration-full-logging

App migration - make sure any issue is logged
This commit is contained in:
Michael Drury 2024-06-10 18:41:24 +01:00 committed by GitHub
commit 2c83363d25
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
1 changed files with 17 additions and 17 deletions

View File

@ -12,6 +12,7 @@ export async function processMigrations(
migrations: AppMigration[] migrations: AppMigration[]
) { ) {
console.log(`Processing app migration for "${appId}"`) console.log(`Processing app migration for "${appId}"`)
try {
// have to wrap in context, this gets the tenant from the app ID // have to wrap in context, this gets the tenant from the app ID
await context.doInAppContext(appId, async () => { await context.doInAppContext(appId, async () => {
await locks.doWithLock( await locks.doWithLock(
@ -21,7 +22,6 @@ export async function processMigrations(
resource: appId, resource: appId,
}, },
async () => { async () => {
try {
await context.doInAppMigrationContext(appId, async () => { await context.doInAppMigrationContext(appId, async () => {
let currentVersion = await getAppMigrationVersion(appId) let currentVersion = await getAppMigrationVersion(appId)
@ -55,13 +55,13 @@ export async function processMigrations(
currentVersion = id currentVersion = id
} }
}) })
} catch (err) {
logging.logAlert("Failed to run app migration", err)
throw err
}
} }
) )
console.log(`App migration for "${appId}" processed`) console.log(`App migration for "${appId}" processed`)
}) })
} catch (err) {
logging.logAlert("Failed to run app migration", err)
throw err
}
} }