mirror of
				https://github.com/zadam/trilium.git
				synced 2025-10-31 18:36:30 +01:00 
			
		
		
		
	sync fixes
This commit is contained in:
		
							
								
								
									
										5
									
								
								db/migrations/0181__fix_entityChanges_isSynced.sql
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										5
									
								
								db/migrations/0181__fix_entityChanges_isSynced.sql
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,5 @@ | |||||||
|  | UPDATE entity_changes SET isSynced = ( | ||||||
|  |     SELECT options.isSynced | ||||||
|  |     FROM options | ||||||
|  |     WHERE options.name = entity_changes.entityId | ||||||
|  | ) WHERE entityName = 'options'; | ||||||
| @@ -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 = 180; | const APP_DB_VERSION = 181; | ||||||
| const SYNC_VERSION = 19; | const SYNC_VERSION = 19; | ||||||
| const CLIPPER_PROTOCOL_VERSION = "1.0"; | const CLIPPER_PROTOCOL_VERSION = "1.0"; | ||||||
|  |  | ||||||
|   | |||||||
| @@ -1,4 +1,5 @@ | |||||||
| const sql = require('./sql'); | const sql = require('./sql'); | ||||||
|  | const log = require('./log'); | ||||||
| const entityChangesService = require('./entity_changes.js'); | const entityChangesService = require('./entity_changes.js'); | ||||||
| const eventService = require('./events'); | const eventService = require('./events'); | ||||||
| const entityConstructor = require('../entities/entity_constructor'); | const entityConstructor = require('../entities/entity_constructor'); | ||||||
| @@ -6,6 +7,18 @@ const entityConstructor = require('../entities/entity_constructor'); | |||||||
| function updateEntity(entityChange, entity, sourceId) { | function updateEntity(entityChange, entity, sourceId) { | ||||||
|     // can be undefined for options with isSynced=false |     // can be undefined for options with isSynced=false | ||||||
|     if (!entity) { |     if (!entity) { | ||||||
|  |         if (entityChange.isSynced) { | ||||||
|  |             if (entityChange.isErased) { | ||||||
|  |                 entityChangesService.addEntityChange(entityChange, sourceId); | ||||||
|  |             } | ||||||
|  |             else { | ||||||
|  |                 log.info(`Encountered synced non-erased entity change without entity: ${JSON.stringify(entityChange)}`); | ||||||
|  |             } | ||||||
|  |         } | ||||||
|  |         else if (entityChange.entityName !== 'options') { | ||||||
|  |             log.info(`Encountered unsynced non-option entity change without entity: ${JSON.stringify(entityChange)}`); | ||||||
|  |         } | ||||||
|  |  | ||||||
|         return; |         return; | ||||||
|     } |     } | ||||||
|  |  | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user