@@ -46,7 +46,7 @@ export async function checkAndImportDatabaseIntegrity(event: H3Event, collection
4646 integrityCheckPromise [ String ( collection ) ] = integrityCheckPromise [ String ( collection ) ] || _checkAndImportDatabaseIntegrity ( event , collection , checksums [ String ( collection ) ] , config )
4747 . then ( ( isValid ) => { checkDatabaseIntegrity [ String ( collection ) ] = ! isValid } )
4848 . catch ( ( error ) => {
49- console . log ( 'Database integrity check failed' , error )
49+ console . error ( 'Database integrity check failed' , error )
5050 checkDatabaseIntegrity [ String ( collection ) ] = true
5151 integrityCheckPromise [ String ( collection ) ] = null
5252 } )
@@ -61,7 +61,6 @@ 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 } ` )
6564
6665 if ( before ?. version ) {
6766 if ( before ?. version === integrityVersion ) {
@@ -71,16 +70,13 @@ async function _checkAndImportDatabaseIntegrity(event: H3Event, collection: stri
7170 await db . exec ( `DELETE FROM ${ tables . info } WHERE id = 'checksum_${ collection } '` )
7271 }
7372
74- const now = Date . now ( )
7573 const dump = await loadDatabaseDump ( event , collection ) . then ( decompressSQLDump )
76- console . log ( `loadDatabaseDump: ${ Date . now ( ) - now } ms` )
7774
7875 await dump . reduce ( async ( prev : Promise < void > , sql : string ) => {
7976 await prev
8077 await db . exec ( sql ) . catch ( ( err : Error ) => {
8178 const message = err . message || 'Unknown error'
82- // console.log('Failed to execute SQL', message.split(':').pop()?.trim())
83- console . log ( `Failed to execute SQL ${ sql } : ${ message } ` )
79+ console . error ( `Failed to execute SQL ${ sql } : ${ message } ` )
8480 // throw error
8581 } )
8682 } , Promise . resolve ( ) )
0 commit comments