feat(database): add logger to database migration
This commit is contained in:
parent
537acd5658
commit
30b0a1c584
@ -18,6 +18,7 @@
|
||||
"typescript": "^5.0.0"
|
||||
},
|
||||
"dependencies": {
|
||||
"@boring.tools/logger": "workspace:*",
|
||||
"drizzle-orm": "^0.33.0",
|
||||
"pg": "^8.13.0"
|
||||
}
|
||||
|
@ -1,3 +1,4 @@
|
||||
import { logger } from '@boring.tools/logger'
|
||||
import { migrate } from 'drizzle-orm/postgres-js/migrator'
|
||||
import { client, db } from './'
|
||||
|
||||
@ -5,9 +6,9 @@ export const migrateDatabase = async (dir: string) => {
|
||||
try {
|
||||
await migrate(db, { migrationsFolder: dir })
|
||||
await client.end()
|
||||
console.log('Migrations: Ok')
|
||||
logger.log('Migrations: Ok')
|
||||
} catch (error) {
|
||||
console.error('Migrations: Failed')
|
||||
console.error(error)
|
||||
logger.error('Migrations: Failed')
|
||||
logger.error(error)
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user