1
0
Fork 0
mirror of synced 2024-07-07 07:15:43 +12:00

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

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 {