2020-12-05 15:26:54 +05:00
|
|
|
export const migrations = {
|
|
|
|
|
0: {
|
2020-12-06 10:52:00 +05:00
|
|
|
note: function (item) {
|
2020-12-06 11:13:17 +05:00
|
|
|
if (item.content) {
|
|
|
|
|
const contentId = item.content.delta;
|
|
|
|
|
delete item.content;
|
|
|
|
|
item.contentId = contentId;
|
|
|
|
|
}
|
2020-12-06 15:16:29 +05:00
|
|
|
if (item.notebook.id) {
|
2020-12-06 11:13:17 +05:00
|
|
|
const notebook = item.notebook;
|
|
|
|
|
item.notebooks = [notebook];
|
|
|
|
|
}
|
2020-12-06 15:16:29 +05:00
|
|
|
delete item.notebook;
|
2020-12-05 15:26:54 +05:00
|
|
|
item.remote = true;
|
2020-12-06 10:52:00 +05:00
|
|
|
return item;
|
2020-12-05 15:26:54 +05:00
|
|
|
},
|
2020-12-06 10:52:00 +05:00
|
|
|
delta: function (item) {
|
2020-12-05 15:26:54 +05:00
|
|
|
item.data = item.data.ops;
|
|
|
|
|
item.type = "delta";
|
2020-12-06 10:52:00 +05:00
|
|
|
return item;
|
2020-12-05 15:26:54 +05:00
|
|
|
},
|
2020-12-06 10:52:00 +05:00
|
|
|
trash: function (item) {
|
2020-12-05 15:26:54 +05:00
|
|
|
item.itemType = item.type;
|
|
|
|
|
item.type = "trash";
|
|
|
|
|
if (item.itemType === "note") {
|
|
|
|
|
item.contentId = item.content.delta;
|
|
|
|
|
delete item.content;
|
|
|
|
|
}
|
2020-12-06 10:52:00 +05:00
|
|
|
return item;
|
2020-12-05 15:26:54 +05:00
|
|
|
},
|
|
|
|
|
},
|
|
|
|
|
2: {
|
2020-12-06 10:52:00 +05:00
|
|
|
note: function (item) {
|
2020-12-05 15:26:54 +05:00
|
|
|
// notebook -> notebooks
|
|
|
|
|
const notebook = item.notebook;
|
|
|
|
|
delete item.notebook;
|
|
|
|
|
item.remote = true;
|
|
|
|
|
if (notebook) item.notebooks = [notebook];
|
2020-12-06 10:52:00 +05:00
|
|
|
return item;
|
2020-12-05 15:26:54 +05:00
|
|
|
},
|
|
|
|
|
},
|
|
|
|
|
3: {
|
2020-12-06 10:52:00 +05:00
|
|
|
note: false,
|
2020-12-06 11:13:17 +05:00
|
|
|
notebooks: false,
|
2020-12-06 10:52:00 +05:00
|
|
|
tag: false,
|
|
|
|
|
trash: false,
|
2020-12-06 11:13:17 +05:00
|
|
|
delta: false,
|
2020-12-06 10:52:00 +05:00
|
|
|
settings: false,
|
2020-12-05 15:26:54 +05:00
|
|
|
},
|
|
|
|
|
};
|