Skip to content

Conversation

@jhecking
Copy link
Contributor

@jhecking jhecking commented Apr 1, 2024

onConflict should accept any column reference, including raw() and ref() as input. This may be required to specify a conflict condition on a partial index. E.g. we use a query like this which works just fine for us:

await Resource._query()
  .insert(resources)
  .onConflict(raw(`(aka) where status != 'DELETED'`))
  .merge()

This is explicitly supported by knex: https://knexjs.org/guide/query-builder.html#onconflict

`onConflict` should accept any column reference, including `raw()` and `ref()` as input. This may be required to specify a conflict condition on a partial index, e.g. we use a query like this which works just fine for us:

```typescript
await Resource._query()
  .insert(resources)
  .onConflict(raw(`(aka) where status != 'DELETED'`))
  .merge()
```

This is explicitly supported by knex: https://knexjs.org/guide/query-builder.html#onconflict
@lehni lehni merged commit 52582fe into Vincit:main Sep 25, 2024
@jhecking jhecking deleted the patch-1 branch September 25, 2024 14:10
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants