Simplify try-catch in the migrate function.

This commit is contained in:
Sam Rose 2023-10-25 16:49:29 +01:00
parent 4a00649f7f
commit 6c3b535863
No known key found for this signature in database
1 changed files with 1 additions and 5 deletions

View File

@ -34,10 +34,8 @@ export async function migrate(
table = await sdk.tables.saveTable(table)
let migrator = getColumnMigrator(table, oldColumn, newColumn)
let result: MigrationResult
try {
result = await migrator.doMigration()
return await migrator.doMigration()
} catch (e) {
// If the migration fails then we need to roll back the table schema
// change.
@ -45,8 +43,6 @@ export async function migrate(
await sdk.tables.saveTable(table)
throw e
}
return result
}
interface ColumnMigrator {