1
0
Fork 0
mirror of synced 2024-10-05 20:44:47 +13: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) 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 {