Safe Haskell | Safe-Inferred |
---|---|
Language | Haskell2010 |
Postgres Schema OnConflict
This module contains the building blocks for parsing on_conflict
clauses,
which in the Postgres backend are used to implement upsert functionality.
These are used by backendInsertParser
to
construct a postgres-specific schema parser for insert (and upsert) mutations.
Synopsis
- onConflictFieldParser :: forall pgKind r m n. (MonadBuildSchema ('Postgres pgKind) r m n, AggregationPredicatesSchema ('Postgres pgKind)) => TableInfo ('Postgres pgKind) -> SchemaT r m (InputFieldsParser n (Maybe (OnConflictClause ('Postgres pgKind) (UnpreparedValue ('Postgres pgKind)))))
Documentation
onConflictFieldParser :: forall pgKind r m n. (MonadBuildSchema ('Postgres pgKind) r m n, AggregationPredicatesSchema ('Postgres pgKind)) => TableInfo ('Postgres pgKind) -> SchemaT r m (InputFieldsParser n (Maybe (OnConflictClause ('Postgres pgKind) (UnpreparedValue ('Postgres pgKind))))) Source #
Parser for a field name on_conflict
of type tablename_on_conflict
.
The tablename_on_conflict
object is used to generate the ON CONFLICT
SQL clause, indicating what should be done if an insert raises a conflict.
The types ordinarily produced by this parser are only created if the table has unique or primary keys constraints.
If there are no columns for which the current role has update permissions, we
must still accept an empty list for update_columns
to support the "ON
CONFLICT DO NOTHING" case. We do this by adding a placeholder value to the
enum. See https://github.com/hasura/graphql-engine/issues/6804.