Files
speckle-server/packages/server/db/migrations.ts
T
Iain Sproat f5c29791ba fix(logging): remove duplicate log (#3678)
- the error is logged at the top level, so we do not need to log deeper
- instead, wrap the error with the additional information and throw
2024-12-11 17:21:40 +01:00

16 lines
489 B
TypeScript

import { Knex } from 'knex'
import { DatabaseError } from '@/modules/shared/errors'
import { ensureError } from '@speckle/shared'
export const migrateDbToLatest = async (params: { db: Knex; region: string }) => {
const { db, region } = params
try {
await db.migrate.latest()
} catch (err: unknown) {
throw new DatabaseError('Error migrating db to latest for region "{region}".', {
cause: ensureError(err, 'Unknown postgres error'),
info: { region }
})
}
}