Commit a257831c authored by alancnet's avatar alancnet Committed by Nicolas Giard

fix: rebuild-tree exceeds mssql parameter limit (#1328)

* fix: rebuild-tree exceeds mssql's parameter limit * docs: details per query max parameters limits Co-authored-by: 's avatarNicolas Giard <github@ngpixel.com>
parent a457e82b
......@@ -53,7 +53,10 @@ module.exports = async (pageId) => {
await WIKI.models.knex.table('pageTree').truncate()
if (tree.length > 0) {
await WIKI.models.knex.table('pageTree').insert(tree)
// -> Save in chunks, because of per query max parameters (35k Postgres, 2k MSSQL, 1k for SQLite)
for (const chunk of _.chunk(tree, 100)) {
await WIKI.models.knex.table('pageTree').insert(chunk)
}
}
await WIKI.models.knex.destroy()
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment