Skip to content

Commit 2548b35

Browse files
committed
chore: more logs
1 parent a79040d commit 2548b35

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

src/runtime/internal/database.server.ts

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -61,6 +61,7 @@ async function _checkAndImportDatabaseIntegrity(event: H3Event, collection: stri
6161
const db = await loadDatabaseAdapter(config)
6262

6363
const before = await db.first<{ version: string }>(`select * from ${tables.info} where id = 'checksum_${collection}'`).catch(() => ({ version: '' }))
64+
console.log(`checkAndImportDatabaseIntegrity: ${collection}, before: ${before?.version}, now: ${integrityVersion}`)
6465

6566
if (before?.version) {
6667
if (before?.version === integrityVersion) {
@@ -70,13 +71,16 @@ async function _checkAndImportDatabaseIntegrity(event: H3Event, collection: stri
7071
await db.exec(`DELETE FROM ${tables.info} WHERE id = 'checksum_${collection}'`)
7172
}
7273

74+
const now = Date.now()
7375
const dump = await loadDatabaseDump(event, collection).then(decompressSQLDump)
76+
console.log(`loadDatabaseDump: ${Date.now() - now}ms`)
7477

7578
await dump.reduce(async (prev: Promise<void>, sql: string) => {
7679
await prev
7780
await db.exec(sql).catch((err: Error) => {
7881
const message = err.message || 'Unknown error'
79-
console.log('Failed to execute SQL', message.split(':').pop()?.trim())
82+
// console.log('Failed to execute SQL', message.split(':').pop()?.trim())
83+
console.log(`Failed to execute SQL ${sql}: ${message}`)
8084
// throw error
8185
})
8286
}, Promise.resolve())

0 commit comments

Comments
 (0)