core: update core version to 5.8

This commit is contained in:
Abdullah Atta
2022-10-12 20:33:37 +05:00
committed by Abdullah Atta
parent 0a94ee7c60
commit f3fa7fe744
4 changed files with 19 additions and 15 deletions

View File

@@ -128,14 +128,7 @@ class Merger {
// it is a locked note, bail out.
if (deserialized.alg && deserialized.cipher) return deserialized;
let type = deserialized.type;
// temporary fix for streetwriters/notesnook#751
if (type === "content") {
type = "tiptap";
deserialized.type = type;
}
return migrateItem(deserialized, version, type, this._db);
return migrateItem(deserialized, version, deserialized.type, this._db);
}
async _deserialize(item, migrate = true) {

View File

@@ -83,4 +83,4 @@ export const EVENTS = {
systemTimeInvalid: "system:invalidTime"
};
export const CURRENT_DATABASE_VERSION = 5.7;
export const CURRENT_DATABASE_VERSION = 5.8;

View File

@@ -30,16 +30,12 @@ class Migrator {
continue;
}
// check if item is permanently deleted or just a soft delete
if (item.deleted && !item.type) {
await collection.dbCollection?._collection?.addItem(item);
continue;
}
// temporary fix for streetwriters/notesnook#751
if (item.type === "content") {
item.type = "tiptap";
}
item = await migrateItem(
item,
version,

View File

@@ -98,7 +98,22 @@ const migrations = [
}
}
},
{ version: 5.7, types: {} }
{
version: 5.7,
types: {
tiny: (item) => {
if (!item.data || item.data.iv) return item;
item.type = "tiptap";
return item;
},
content: (item) => {
if (!item.data || item.data.iv) return item;
item.type = "tiptap";
return item;
}
}
},
{ version: 5.8, types: {} }
];
export async function migrateItem(item, version, type, database) {