graphql-engine/server/src-lib/Hasura/Backends/MSSQL
Antoine Leblanc 0a69db81c9 Move RoleName into SchemaContext.
### Description

I am not 100% sure about this PR; while I think the code is better this way, I'm willing to be convinced otherwise.

In short, this PR moves the `RoleName` field into the `SchemaContext`, instead of being a nebulous `Has RoleName` constraint on the reader monad. The major upside of this is that it makes it an explicit named field, rather than something that must be given as part of a tuple of arguments when calling `runReader`.

However, the downside is that it breaks the helper permissions functions of `Schema.Table`, which relied on `Has RoleName r`. This PR makes the choice of passing the role name explicitly to all of those functions, which in turn means first explicitly fetching the role name in a lot of places. It makes it more explicit when a schema building block relies on the role name, but is a bit verbose...

### Alternatives

Some alternatives worth considering:
- attempting something like `Has context r, Has RoleName context`, which would allow them to be independent from the context but still fetch the role name from the reader, but might require type annotations to not be ambiguous
- keeping the permission functions the same, with `Has RoleName r`, and introducing a bunch of newtypes instead of using tuples to explicitly implement all the required `Has` instances
- changing the permission functions to `Has SchemaContext r`, since they are functions used only to build the schema, and therefore may be allowed to be tied to the context.

What do y'all think?

PR-URL: https://github.com/hasura/graphql-engine-mono/pull/5073
GitOrigin-RevId: 8fd09fafb54905a4d115ef30842d35da0c3db5d2
2022-07-29 15:38:44 +00:00
..
DDL Remove strictness annotations from data types in the Hasura.Backends hierarchy 2022-07-29 14:06:23 +00:00
Execute Move SchemaOptions to its own module, remove magic bools 2022-07-14 17:59:01 +00:00
FromIr server: transform enum with upper for graphql-default 2022-07-19 06:56:45 +00:00
Instances Move RoleName into SchemaContext. 2022-07-29 15:38:44 +00:00
Schema Move RoleName into SchemaContext. 2022-07-29 15:38:44 +00:00
SQL Remove RQL/Types.hs 2022-04-27 13:58:47 +00:00
Types Remove strictness annotations from data types in the Hasura.Backends hierarchy 2022-07-29 14:06:23 +00:00
Connection.hs Remove strictness annotations from data types in the Hasura.Backends hierarchy 2022-07-29 14:06:23 +00:00
DDL.hs Move MkTypename and NamingCase into their own modules. 2022-07-12 14:01:28 +00:00
FromIr.hs Tidy up MSSQL.FromIr 2022-03-10 10:34:52 +00:00
Meta.hs An ErrorMessage type, to encapsulate. 2022-07-18 20:27:06 +00:00
Plan.hs Remove strictness annotations from data types in the Hasura.Backends hierarchy 2022-07-29 14:06:23 +00:00
ToQuery.hs server: fix create event trigger failure on tables with MSSQL reserved keywords as name 2022-06-15 17:11:44 +00:00
Types.hs Add docstrings to the module headers of a few selected mssql modules 2022-01-03 17:17:18 +00:00