(sql, table, columns, dataArray, batchSize = 1000)
| 17 | const sql = postgres(DATABASE_URL) |
| 18 | |
| 19 | async function batchInsert(sql, table, columns, dataArray, batchSize = 1000) { |
| 20 | for (let i = 0; i < dataArray.length; i += batchSize) { |
| 21 | const batch = dataArray.slice(i, i + batchSize) |
| 22 | |
| 23 | await sql` |
| 24 | INSERT INTO ${sql(table)} ${sql(batch, columns)} |
| 25 | ` |
| 26 | |
| 27 | process.stdout.write( |
| 28 | `Loaded ${Math.min(i + batchSize, dataArray.length)} of ${dataArray.length} ${table}s\r` |
| 29 | ) |
| 30 | } |
| 31 | } |
| 32 | |
| 33 | const issueCount = issues.length |
| 34 | let commentCount = 0 |
no test coverage detected