diff --git a/db/migrations/0187__add_changeId_to_entity_changes.sql b/db/migrations/0187__add_changeId_to_entity_changes.sql index 315d73f2c..925db2eb7 100644 --- a/db/migrations/0187__add_changeId_to_entity_changes.sql +++ b/db/migrations/0187__add_changeId_to_entity_changes.sql @@ -1,5 +1,5 @@ -- delete duplicates https://github.com/zadam/trilium/issues/2534 -DELETE FROM entity_changes WHERE id IN ( +DELETE FROM entity_changes WHERE isErased = 0 AND id IN ( SELECT id FROM entity_changes ec WHERE ( SELECT COUNT(*) FROM entity_changes