Simplify try-catch in the migrate function.
This commit is contained in:
parent
4a00649f7f
commit
6c3b535863
|
@ -34,10 +34,8 @@ export async function migrate(
|
||||||
table = await sdk.tables.saveTable(table)
|
table = await sdk.tables.saveTable(table)
|
||||||
|
|
||||||
let migrator = getColumnMigrator(table, oldColumn, newColumn)
|
let migrator = getColumnMigrator(table, oldColumn, newColumn)
|
||||||
let result: MigrationResult
|
|
||||||
|
|
||||||
try {
|
try {
|
||||||
result = await migrator.doMigration()
|
return await migrator.doMigration()
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
// If the migration fails then we need to roll back the table schema
|
// If the migration fails then we need to roll back the table schema
|
||||||
// change.
|
// change.
|
||||||
|
@ -45,8 +43,6 @@ export async function migrate(
|
||||||
await sdk.tables.saveTable(table)
|
await sdk.tables.saveTable(table)
|
||||||
throw e
|
throw e
|
||||||
}
|
}
|
||||||
|
|
||||||
return result
|
|
||||||
}
|
}
|
||||||
|
|
||||||
interface ColumnMigrator {
|
interface ColumnMigrator {
|
||||||
|
|
Loading…
Reference in New Issue