added migration to fix notePosition to always step in 10 increments

This commit is contained in:
zadam 2020-09-23 23:08:58 +02:00
parent a577485e42
commit 5f6dd18489
3 changed files with 15 additions and 1 deletions

Binary file not shown.

View 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;
}
}
};

View File

@ -4,7 +4,7 @@ const build = require('./build');
const packageJson = require('../../package'); const packageJson = require('../../package');
const {TRILIUM_DATA_DIR} = require('./data_dir'); const {TRILIUM_DATA_DIR} = require('./data_dir');
const APP_DB_VERSION = 169; const APP_DB_VERSION = 170;
const SYNC_VERSION = 16; const SYNC_VERSION = 16;
const CLIPPER_PROTOCOL_VERSION = "1.0"; const CLIPPER_PROTOCOL_VERSION = "1.0";