Skip to content

Commit

Permalink
fix: let database handle id generation
Browse files Browse the repository at this point in the history
  • Loading branch information
samuelstroschein committed Oct 17, 2024
1 parent 3ca8aa0 commit f375f42
Showing 1 changed file with 8 additions and 8 deletions.
16 changes: 8 additions & 8 deletions lix/packages/sdk/src/file-handlers.ts
Original file line number Diff line number Diff line change
Expand Up @@ -54,10 +54,10 @@ export async function handleFileInsert(args: {
const snapshot = await trx
.insertInto("snapshot")
.values({
// TODO use empty snapshot id const https://github.com/opral/lix-sdk/issues/101
id: detectedChange.snapshot ? undefined : "EMPTY_SNAPSHOT_ID",
// @ts-expect-error - database expects stringified json
value: JSON.stringify(detectedChange.snapshot),
// @ts-expect-error- database expects stringified json
value: detectedChange.snapshot
? JSON.stringify(detectedChange.snapshot)
: null,
})
.onConflict((oc) => oc.doNothing())
.returning("id")
Expand Down Expand Up @@ -147,10 +147,10 @@ export async function handleFileChange(args: {
const snapshot = await trx
.insertInto("snapshot")
.values({
// TODO use empty snapshot id const https://github.com/opral/lix-sdk/issues/101
id: detectedChange.snapshot ? undefined : "EMPTY_SNAPSHOT_ID",
// @ts-expect-error - database expects stringified json
value: JSON.stringify(detectedChange.snapshot),
// @ts-expect-error- database expects stringified json
value: detectedChange.snapshot
? JSON.stringify(detectedChange.snapshot)
: null,
})
.onConflict((oc) => oc.doNothing())
.returning("id")
Expand Down

0 comments on commit f375f42

Please sign in to comment.