mirror of
				https://github.com/zadam/trilium.git
				synced 2025-11-03 20:06:08 +01:00 
			
		
		
		
	migration to convert H1 to H2, #1240
This commit is contained in:
		
							
								
								
									
										18
									
								
								db/migrations/0169__convert_h1_to_h2.js
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										18
									
								
								db/migrations/0169__convert_h1_to_h2.js
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,18 @@
 | 
			
		||||
const repository = require('../../src/services/repository');
 | 
			
		||||
 | 
			
		||||
module.exports = () => {
 | 
			
		||||
    for (const note of repository.getEntities("SELECT * FROM notes WHERE type = 'text' AND isProtected = 0")) {
 | 
			
		||||
        try {
 | 
			
		||||
            let content = note.getContent();
 | 
			
		||||
 | 
			
		||||
            content = content
 | 
			
		||||
                .replace(/<h1/ig, "<h2")
 | 
			
		||||
                .replace(/<\/h1/ig, "</h2");
 | 
			
		||||
 | 
			
		||||
            note.setContent(content);
 | 
			
		||||
        }
 | 
			
		||||
        catch (e) {
 | 
			
		||||
            console.log(`Changing note content for note ${note.noteId} failed with: ${e.message} ${e.stack}`);
 | 
			
		||||
        }
 | 
			
		||||
    }
 | 
			
		||||
};
 | 
			
		||||
@@ -4,7 +4,7 @@ const build = require('./build');
 | 
			
		||||
const packageJson = require('../../package');
 | 
			
		||||
const {TRILIUM_DATA_DIR} = require('./data_dir');
 | 
			
		||||
 | 
			
		||||
const APP_DB_VERSION = 168;
 | 
			
		||||
const APP_DB_VERSION = 169;
 | 
			
		||||
const SYNC_VERSION = 16;
 | 
			
		||||
const CLIPPER_PROTOCOL_VERSION = "1.0";
 | 
			
		||||
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user