1
0
Fork 0
mirror of synced 2024-07-12 17:56:07 +12:00

Log every step of the app migration process for easier visibility.

This commit is contained in:
mike12345567 2024-06-10 19:19:43 +01:00
parent 7d28dbd4c8
commit 834de1f64a

View file

@ -15,6 +15,7 @@ export async function processMigrations(
try {
// have to wrap in context, this gets the tenant from the app ID
await context.doInAppContext(appId, async () => {
console.log(`Acquiring app migration lock for "${appId}"`)
await locks.doWithLock(
{
name: LockName.APP_MIGRATION,
@ -23,6 +24,7 @@ export async function processMigrations(
},
async () => {
await context.doInAppMigrationContext(appId, async () => {
console.log(`Lock acquired starting app migration for "${appId}"`)
let currentVersion = await getAppMigrationVersion(appId)
const pendingMigrations = migrations
@ -30,6 +32,9 @@ export async function processMigrations(
.sort((a, b) => a.id.localeCompare(b.id))
const migrationIds = migrations.map(m => m.id).sort()
console.log(
`App migrations to run for "${appId}" - ${migrationIds.join(",")}`
)
let index = 0
for (const { id, func } of pendingMigrations) {