mirror of
https://github.com/zadam/trilium.git
synced 2025-11-17 22:29:19 +08:00
added migration to fix notePosition to always step in 10 increments
This commit is contained in:
parent
a577485e42
commit
5f6dd18489
3 changed files with 15 additions and 1 deletions
BIN
db/demo.zip
BIN
db/demo.zip
Binary file not shown.
14
db/migrations/0170__fix_branch_ordering.js
Normal file
14
db/migrations/0170__fix_branch_ordering.js
Normal file
|
|
@ -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;
|
||||
}
|
||||
}
|
||||
};
|
||||
|
|
@ -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";
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue