Hello dude!
First of all, thank you by the great article, it help me a lot.
I've noticed that in the clear function you put an await function inside a forEach iterator, but in this case the promise will not work properly.
I solve this issue using the map instead the forEach and placing the map result inside a Promise.all(). This works great to me.
constentityDeletionPromises=entities.map((entity)=>async()=>{constrepository=connection.getRepository(entity.name);awaitrepository.query(`DELETE FROM ${entity.tableName}`);});awaitPromise.all(entityDeletionPromises);
Hello dude!
First of all, thank you by the great article, it help me a lot.
I've noticed that in the
clearfunction you put anawaitfunction inside aforEachiterator, but in this case the promise will not work properly.I solve this issue using the
mapinstead theforEachand placing the map result inside aPromise.all(). This works great to me.Can you put your example here please?
Here you go:
I'm currently using typeorm 0.2.31 and they allow for
repo.clear()to truncate / drop the table