Skip to content

A fully open source & end-to-end encrypted note taking alternative to Evernote.

core: fix notes with no conflict marked as conflicted

Abdullah Atta43f466936012
diff --git a/packages/core/src/api/sync/index.ts b/packages/core/src/api/sync/index.ts
index 4c40389b5..b8c94181b 100644
--- a/packages/core/src/api/sync/index.ts
+++ b/packages/core/src/api/sync/index.ts
@@ -251,7 +251,7 @@ class Sync {
.selectFrom("content")
.select("noteId as id")
.where("conflicted", "is not", null)
- .where("conflicted", "is not", false)
+ .where("conflicted", "!=", false)
.$castTo<string | null>()
)
.set({ conflicted: true })
diff --git a/packages/core/src/database/migrations.ts b/packages/core/src/database/migrations.ts
index 12fa7a161..970bc3662 100644
--- a/packages/core/src/database/migrations.ts
+++ b/packages/core/src/database/migrations.ts
@@ -289,6 +289,26 @@ export class NNMigrationProvider implements MigrationProvider {
async up(db) {
await rebuildSearchIndex(db);
}
+ },
+ "3": {
+ async up(db) {
+ await db
+ .updateTable("notes")
+ .where("id", "in", (eb) =>
+ eb
+ .selectFrom("content")
+ .select("noteId as id")
+ .where((eb) =>
+ eb.or([
+ eb("conflicted", "is", null),
+ eb("conflicted", "==", false)
+ ])
+ )
+ .$castTo<string | null>()
+ )
+ .set({ conflicted: false })
+ .execute();
+ }
}
};
}