diff --git a/db/migrations/0188__set_hidden_branchId.sql b/db/migrations/0188__set_hidden_branchId.sql index abb2d18f5..8ef8116d7 100644 --- a/db/migrations/0188__set_hidden_branchId.sql +++ b/db/migrations/0188__set_hidden_branchId.sql @@ -1 +1,8 @@ -UPDATE branches SET branchId = 'hidden' where parentNoteId = 'root' AND noteId = 'hidden'; +UPDATE branches SET branchId = 'hidden' where branchId = ( + SELECT branchId FROM branches + WHERE parentNoteId = 'root' + AND noteId = 'hidden' + AND isDeleted = 0 + ORDER BY utcDateModified + LIMIT 1 +);