|
|
@ -53,7 +53,16 @@ module.exports = async (pageId) => {
|
|
|
|
|
|
|
|
|
|
|
|
await WIKI.models.knex.table('pageTree').truncate()
|
|
|
|
await WIKI.models.knex.table('pageTree').truncate()
|
|
|
|
if (tree.length > 0) {
|
|
|
|
if (tree.length > 0) {
|
|
|
|
await WIKI.models.knex.table('pageTree').insert(tree)
|
|
|
|
const { bindings, sql } = WIKI.models.knex.table('pageTree').insert(tree).toSQL();
|
|
|
|
|
|
|
|
if (WIKI.config.db.type === 'mssql') {
|
|
|
|
|
|
|
|
await WIKI.models.knex.raw(sql, bindings).wrap(
|
|
|
|
|
|
|
|
'SET IDENTITY_INSERT pageTree ON;',
|
|
|
|
|
|
|
|
'SET IDENTITY_INSERT pageTree OFF;',
|
|
|
|
|
|
|
|
)
|
|
|
|
|
|
|
|
} else {
|
|
|
|
|
|
|
|
await WIKI.models.knex.raw(sql, bindings)
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
// await WIKI.models.knex.table('pageTree').insert(tree)
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
await WIKI.models.knex.destroy()
|
|
|
|
await WIKI.models.knex.destroy()
|
|
|
|