0

I am looking for a solution to my problem. I have a large array that contains sql scripts. But I don't know how to run them sequentially.. and after then exit. Exactly wait for finished of each other.

It's probably simple to decipher, but I can't figure it out.

(+ and It exit too soon)

var rows = ["CREATE TABLE...", "CREATE T2...", "CREATE T3...", "INSERT INTO T.." ...];

rows.forEach((row) => {
  client.query(row).then((res => {
     console.log(res);
  });
})

exit();
Laszlo
  • 29
  • 4

0 Answers0