graphql-engine/server/src-lib/Hasura/Backends/BigQuery/Instances/Metadata.hs
Antoine Leblanc 04d8f068b6 Remove explicit case on the backend tag in Cache
### Description

As part of the cache building process, we create / update / migrate the catalog that each DB uses as a place to store event trigger information. The function that decides how this should be done was doing an explicit `case ... of` on the backend tag, instead of delegating to one of the backend classes. The downsides of this is that:
- it adds a "friction point" where the backend matters in the core of the engine, which is otherwise written to be almost entirely backend-agnostic
- it creates imports from deep in the engine to the `Backends`, which we try to restrict to a very small set of clearly identified files (the `Instances` files)
- it is currently implemented using a "catch all" default case, which might not always be correct for new backends

This PR makes the catalog updating process a part of `BackendMetadata`, and cleans the corresponding schema cache code.

PR-URL: https://github.com/hasura/graphql-engine-mono/pull/4457
GitOrigin-RevId: 592f0eaa97a7c38f4e6d4400e1d2353aab12c97e
2022-05-05 13:44:56 +00:00

22 lines
923 B
Haskell

{-# OPTIONS_GHC -fno-warn-orphans #-}
module Hasura.Backends.BigQuery.Instances.Metadata () where
import Hasura.Backends.BigQuery.DDL qualified as BigQuery
import Hasura.Prelude
import Hasura.RQL.Types.EventTrigger (RecreateEventTriggers (RETDoNothing))
import Hasura.RQL.Types.Metadata.Backend
import Hasura.SQL.Backend
instance BackendMetadata 'BigQuery where
prepareCatalog = const $ pure RETDoNothing
buildComputedFieldInfo = BigQuery.buildComputedFieldInfo
fetchAndValidateEnumValues = BigQuery.fetchAndValidateEnumValues
resolveSourceConfig = BigQuery.resolveSourceConfig
resolveDatabaseMetadata _ = BigQuery.resolveSource
parseBoolExpOperations = BigQuery.parseBoolExpOperations
buildFunctionInfo = BigQuery.buildFunctionInfo
updateColumnInEventTrigger = BigQuery.updateColumnInEventTrigger
parseCollectableType = BigQuery.parseCollectableType
postDropSourceHook = BigQuery.postDropSourceHook