Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix argument types of onConflict #2635

Merged
merged 1 commit into from
Sep 25, 2024
Merged

Fix argument types of onConflict #2635

merged 1 commit into from
Sep 25, 2024

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