graphql-engine/server/src-lib/Hasura/Backends/Postgres
Antoine Leblanc eaba2e08d3 Clean Relay's code, break schema cycles, introduce Node ID V2
## Motivation

This PR rewrites most of Relay to achieve the following:
- ~~fix a bug in which the same node id could refer to two different tables in the schema~~
- remove one of the few remaining uses of the source cache in the schema building code

In doing so, it also:
- simplifies the `BackendSchema` class by removing `node` from it,
- makes it much easier for other backends to support Relay,
- documents, re-organizes, and clarifies the code.

## Description

This PR introduces a new `NodeId` version ~~, and adapts the Postgres code to always generate this V2 version~~. This new id contains the source name, in addition to the table name, in order to disambiguate similar table names across different sources (which is now possible with source customization). In doing so, it now explicitly handles that case for V1 node ids, and returns an explicit error message instead of running the risk of _silently returning the wrong information_.

Furthermore, it adapts `nodeField` to support multiple backends; most of the code was trivial to generalize, and as a result it lowers the cost of entry for other backends, that now only need to support `AFNodeId` in their translation layer.

Finally, it removes one more cycle in the schema building code, by using the same trick we used for remote relationships instead of using the memoization trick of #4576.

## Remaining work

- ~~[ ]write a Changelog entry~~
- ~~[x] adapt all tests that were asserting on an old node id~~

## Future work

This PR was adapted from its original form to avoid a breaking change: while it introduces a Node ID V2, we keep generating V1 IDs and the parser rejects V2 IDs. It will be easy to make the switch at a later data in a subsequent PR.

PR-URL: https://github.com/hasura/graphql-engine-mono/pull/4593
GitOrigin-RevId: 88e5cb91e8b0646900547fa8c7c0e1463de267a1
2022-06-07 13:36:29 +00:00
..
Connection server: log details of healthcheck failure 2022-06-07 11:24:20 +00:00
DDL Add _cast support for other postgres datatypes fix #6050 and fix #5426 2022-06-01 16:41:49 +00:00
Execute Move Hasura.GraphQL.Parser.Column to .RQL.IR. and .GraphQL.Schema. 2022-05-30 22:07:57 +00:00
Instances Clean Relay's code, break schema cycles, introduce Node ID V2 2022-06-07 13:36:29 +00:00
Schema Move Hasura.GraphQL.Parser.Column to .RQL.IR. and .GraphQL.Schema. 2022-05-30 22:07:57 +00:00
SQL server: add support for custom scalar in action output types 2022-06-03 09:48:26 +00:00
Translate Clean Relay's code, break schema cycles, introduce Node ID V2 2022-06-07 13:36:29 +00:00
Types server: add infrastructure to write runit tests for update parsers 2022-05-26 14:06:24 +00:00
Connection.hs server: split the Postgres Connection module 2022-03-09 07:15:17 +00:00
DDL.hs Evie/postgres/module docs 2022-02-08 09:25:35 +00:00