initialize db before nuxt is ready, fix #131

This commit is contained in:
lesion
2021-12-06 12:11:04 +01:00
parent 40f6978e76
commit 1d80faaa37
4 changed files with 16 additions and 20 deletions

View File

@@ -38,18 +38,18 @@ const db = {
}
})
return await umzug.up()
}
}
if (!config.firstrun) {
try {
db.connect().then(e => {
log.debug('Running migrations')
db.runMigrations()
})
} catch (e) {
log.warn(` ⚠️ Cannot connect to db, check your configuration => ${e}`)
process.exit(1)
},
async initialize () {
if (!config.firstrun) {
try {
await db.connect()
log.debug('Running migrations')
return db.runMigrations()
} catch (e) {
log.warn(` ⚠️ Cannot connect to db, check your configuration => ${e}`)
process.exit(1)
}
}
}
}