-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathcreateGhosts.js
25 lines (19 loc) · 1012 Bytes
/
createGhosts.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
var pool = require('./libs/db');
colors = ["0xFF4000","0xF78181","0xFF00BF","0xFA58D0","0xFA5882","0xFF0040","0xDF3A01","0xFE642E","0xFE2E2E","0xFF00FF"]
count = 0;
pool.connect(function(err, client, done) {
if(err) {
return console.error('error fetching client from pool', err);
}
for (count = 0; count< 30; count++) {
index = count % 10;
//sleep(10)
console.log(count+"---");
client.query('INSERT INTO ghosts(color) VALUES($1) RETURNING ID',[colors[index]], function(err, result) {
done(err);
if(err) {
return console.error('error running query',err);
}
});
}
});