graphql-engine/server/src-lib/Hasura/Backends/BigQuery
Jesse Hallett f4fa960ec6 server: safely signal backend support for event triggers
Hooks up event trigger codecs from #7237. This required fixing a problem where some backend types implemented `defaultTriggerOnReplication` with `error` which caused the server to crash when evaluating those for default values in codecs. The changes here add a type family to `Backend` called `XEventTriggers` that signals backend support for event triggers, and changes the type of `defaultTriggerOnReplication` to from `TriggerOnReplication` to `Maybe (XEventTriggers b, TriggerOnReplication)` so that it can only be implemented with a `Just` value if `XEventTriggers b` is inhabited. This emulates some existing type families in `Backend`. (Thanks to @daniel-chambers for this suggestion!)

I used the implementation of `defaultTriggerOnReplication` as a signal for event triggers support to prune the Metadata API so that event trigger fields will not appear in the OpenAPI spec for backend types that do not support event triggers. The codec version of the API will also not emit or accept those fields for those backend types. I think I could use `Typeable` to test whether `XEventTriggers` is `Void` instead of testing whether `defaultTriggerOnReplication` is `Nothing`. But the codec implementation will crash anyway if `defaultTriggerOnReplication` is `Nothing`.

I checked to make sure that graphql-engine-pro still compiles.

Ticket: https://hasurahq.atlassian.net/browse/GDC-521

PR-URL: https://github.com/hasura/graphql-engine-mono/pull/7295
GitOrigin-RevId: 2b2dd44291513266107ca25cf330319bf53a8b66
2022-12-21 17:15:31 +00:00
..
DDL [server] newtypes for BigQuery projectId and dataset 2022-12-16 13:19:05 +00:00
Instances server: safely signal backend support for event triggers 2022-12-21 17:15:31 +00:00
Parser Upgrade Ormolu to v0.5. 2022-11-02 20:55:13 +00:00
Connection.hs [server] newtypes for BigQuery projectId and dataset 2022-12-16 13:19:05 +00:00
DDL.hs Move MkTypename and NamingCase into their own modules. 2022-07-12 14:01:28 +00:00
Execute.hs [server] newtypes for BigQuery projectId and dataset 2022-12-16 13:19:05 +00:00
FromIr.hs Upgrade Ormolu to v0.5. 2022-11-02 20:55:13 +00:00
Meta.hs [server] newtypes for BigQuery projectId and dataset 2022-12-16 13:19:05 +00:00
Name.hs server: Reorganize quasi-quoted names. 2022-06-23 09:15:31 +00:00
Plan.hs Move Hasura.GraphQL.Parser.Column to .RQL.IR. and .GraphQL.Schema. 2022-05-30 22:07:57 +00:00
Source.hs [server] newtypes for BigQuery projectId and dataset 2022-12-16 13:19:05 +00:00
ToQuery.hs Upgrade Ormolu to v0.5. 2022-11-02 20:55:13 +00:00
Types.hs [server/tests] Round trip tests for BigQuery types 2022-12-21 13:58:58 +00:00