mirror of
https://github.com/zadam/trilium.git
synced 2024-11-17 13:14:44 +08:00
15 lines
450 B
JavaScript
15 lines
450 B
JavaScript
|
const repository = require('../../src/services/repository');
|
||
|
const sql = require('../../src/services/sql');
|
||
|
|
||
|
module.exports = () => {
|
||
|
for (const note of repository.getEntities("SELECT * FROM notes")) {
|
||
|
let position = 0;
|
||
|
|
||
|
for (const branch of note.getChildBranches()) {
|
||
|
sql.execute(`UPDATE branches SET notePosition = ? WHERE branchId = ?`, [position, branch.branchId]);
|
||
|
|
||
|
position += 10;
|
||
|
}
|
||
|
}
|
||
|
};
|