trilium/db/migrations/0204__migrate_bookmarks_to_clones.js

22 lines
802 B
JavaScript
Raw Normal View History

2022-12-05 03:05:18 +08:00
module.exports = () => {
const cls = require("../../src/services/cls");
const cloningService = require("../../src/services/cloning");
const beccaLoader = require("../../src/becca/becca_loader");
const becca = require("../../src/becca/becca");
cls.init(() => {
beccaLoader.load();
for (const attr of becca.findAttributes('label','bookmarked')) {
2022-12-24 19:26:32 +08:00
cloningService.toggleNoteInParent(true, attr.noteId, '_lbBookmarks');
2022-12-05 03:05:18 +08:00
attr.markAsDeleted("0204__migrate_bookmarks_to_clones");
}
// bookmarkFolder used to work in 0.57 without the bookmarked label
for (const attr of becca.findAttributes('label','bookmarkFolder')) {
cloningService.toggleNoteInParent(true, attr.noteId, '_lbBookmarks');
}
2022-12-05 03:05:18 +08:00
});
};