graphql-engine/server/src-lib/Hasura/Backends/MSSQL
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
..
DDL Fix a /= [] and add hint. 2022-05-27 12:28:24 +00:00
Execute Move Hasura.GraphQL.Parser.Column to .RQL.IR. and .GraphQL.Schema. 2022-05-30 22:07:57 +00:00
FromIr replace SQLOperator with ScalarSelectionArguments 2022-05-03 09:00:01 +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 Remove RQL/Types.hs 2022-04-27 13:58:47 +00:00
Types server: naming conventions for auto generated fields 2022-05-26 11:55:29 +00:00
Connection.hs server/MSSQL: Event Delivery System (Incremental PR - 3) 2022-04-21 07:20:34 +00:00
DDL.hs server: naming conventions for auto generated fields 2022-05-26 11:55:29 +00:00
FromIr.hs Tidy up MSSQL.FromIr 2022-03-10 10:34:52 +00:00
Meta.hs Make ForeignKey mappings non-empty 2022-05-10 15:44:46 +00:00
Plan.hs Move Hasura.GraphQL.Parser.Column to .RQL.IR. and .GraphQL.Schema. 2022-05-30 22:07:57 +00:00
ToQuery.hs fix insertion of multiple empty objects 2022-05-30 12:18:36 +00:00
Types.hs Add docstrings to the module headers of a few selected mssql modules 2022-01-03 17:17:18 +00:00