Skip to content

Commit

Permalink
core: fix notes with no conflict marked as conflicted
Browse files Browse the repository at this point in the history
  • Loading branch information
thecodrr committed May 17, 2024
1 parent 3b04925 commit 43f4669
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 1 deletion.
2 changes: 1 addition & 1 deletion packages/core/src/api/sync/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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 })
Expand Down
20 changes: 20 additions & 0 deletions packages/core/src/database/migrations.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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();
}
}
};
}
Expand Down

0 comments on commit 43f4669

Please sign in to comment.