haskell-beam / haskell-beam/beam

Modularize `BeamHasInsertOnConflict`

Open
#809 0 comments 0 reactions 0 assignees View on GitHub
breaking change enhancement
Dominant language
Haskell
Stars
635
Forks
193
PR merge metrics
No merged PRs in 30d

Description

[`BeamHasInsertOnConflict`](https://hackage-content.haskell.org/package/beam-core-0.11.0.0/docs/Database-Beam-Backend-SQL-BeamExtensions.html#t:BeamHasInsertOnConflict) is a typeclass with many methods. The central method is `insertOnConflict`, but others are also attached, such as `conflictingFieldsWhere`.

Unfortunately, not all methods are supported by all DB management systems. Specifically, `conflictingFieldsWhere` is supported by Postgres and SQLite, but not DuckDB. This creates the weird situation whereby the DuckDB backend can have a partial `BeamHasInsertOnConflict` instance (#808), but care must be taken to prevent the user from using `conflictingFieldsWhere`.

Instead, `BeamHasInsertOnConflict` should be modularized. I imagine that `insertOnConflict`, `anyConflict`, `onConflictDoNothing`, `onConflictUpdateSet` would be preserved on `BeamHasInsertOnConflict`, but other methods would be split off into other classes.

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.