File tree Expand file tree Collapse file tree 1 file changed +9
-7
lines changed Expand file tree Collapse file tree 1 file changed +9
-7
lines changed Original file line number Diff line number Diff line change @@ -143,14 +143,16 @@ export async function cleanupDb(prisma: PrismaClient) {
143143				. filter ( Boolean ) 
144144
145145			// Run each sql statement in the migration 
146- 			for  ( const  statement  of  statements )  { 
147- 				try  { 
148- 					await  prisma . $executeRawUnsafe ( `${ statement }  ;` ) 
149- 				}  catch  ( error )  { 
150- 					console . warn ( `Failed to execute statement: ${ statement }  ` ) 
151- 					throw  error 
146+ 			await  prisma . $transaction ( async  ( tx )  =>  { 
147+ 				for  ( const  statement  of  statements )  { 
148+ 					try  { 
149+ 						await  tx . $executeRawUnsafe ( `${ statement }  ` ) 
150+ 					}  catch  ( error )  { 
151+ 						console . warn ( `Failed to execute statement: ${ statement }  ` ) 
152+ 						throw  error 
153+ 					} 
152154				} 
153- 			} 
155+ 			} ) 
154156		} 
155157	}  catch  ( error )  { 
156158		console . error ( 'Error cleaning up database:' ,  error ) 
    
 
   
 
     
   
   
          
     
  
    
     
 
    
      
     
 
     
    You can’t perform that action at this time.
  
 
    
  
     
    
      
        
     
 
       
      
     
   
 
    
    
  
 
  
 
     
    
0 commit comments