From 9df521109bd7d9b432ff673a681acbbaefb83ed6 Mon Sep 17 00:00:00 2001 From: zadam Date: Sat, 8 Jan 2022 22:43:34 +0100 Subject: [PATCH] fix migration to handle duplicates in entity_changes, #2534 --- db/migrations/0187__add_changeId_to_entity_changes.sql | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) 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