I am looking for a way to clear all entries in my database when the server shuts down. Can anyone help with this?
export class RoomsService {
async onApplicationShutdown() {
await this.roomService.deleteAll()
}
async deleteAll(): Promise<DeleteResult> {
const res = await this.roomRepository.delete('*');
return res;
}
During shutdown, I encounter this error message (even without using async/await)
Error: Pool is closed.
at C:\Users\Admin\Desktop\sites\UltimatePartyRoom\upr-server\node_modules\mysql2\lib\pool.js:39:40
at processTicksAndRejections (node:internal/process/task_queues:77:11)