diff --git a/source/src/main/java/one/nem/lacerta/source/database/dao/VcsLogDao.java b/source/src/main/java/one/nem/lacerta/source/database/dao/VcsLogDao.java index 5e1eec55..b8923de9 100644 --- a/source/src/main/java/one/nem/lacerta/source/database/dao/VcsLogDao.java +++ b/source/src/main/java/one/nem/lacerta/source/database/dao/VcsLogDao.java @@ -57,6 +57,6 @@ public interface VcsLogDao { @Query("DELETE FROM vcs_log WHERE id = :id") void deleteById(String id); - @Query("DELETE FROM vcs_log WHERE document_id = :documentId LIMIT 1") + @Query("DELETE FROM vcs_log WHERE id = (SELECT id FROM vcs_log WHERE document_id = :documentId ORDER BY created_at DESC LIMIT 1)") void deleteLatestByDocumentId(String documentId); }