diff --git a/db/demo.zip b/db/demo.zip index 1aee4a863..29a6c9fcc 100644 Binary files a/db/demo.zip and b/db/demo.zip differ diff --git a/db/migrations/0170__fix_branch_ordering.js b/db/migrations/0170__fix_branch_ordering.js new file mode 100644 index 000000000..ad9c219a3 --- /dev/null +++ b/db/migrations/0170__fix_branch_ordering.js @@ -0,0 +1,14 @@ +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; + } + } +}; diff --git a/src/services/app_info.js b/src/services/app_info.js index e710bd6b6..02d3644d3 100644 --- a/src/services/app_info.js +++ b/src/services/app_info.js @@ -4,7 +4,7 @@ const build = require('./build'); const packageJson = require('../../package'); const {TRILIUM_DATA_DIR} = require('./data_dir'); -const APP_DB_VERSION = 169; +const APP_DB_VERSION = 170; const SYNC_VERSION = 16; const CLIPPER_PROTOCOL_VERSION = "1.0";