mirror of
				https://github.com/zadam/trilium.git
				synced 2025-10-29 17:26:38 +01: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;
 | |
|         }
 | |
|     }
 | |
| };
 |