2021-04-22 00:44:37 +03:00
|
|
|
{-# LANGUAGE UndecidableInstances #-}
|
2021-03-18 20:39:35 +03:00
|
|
|
{-# OPTIONS_GHC -fno-warn-orphans #-}
|
|
|
|
|
2022-01-11 01:54:51 +03:00
|
|
|
-- | MSSQL Instances Metadata
|
|
|
|
--
|
|
|
|
-- Defines a 'Hasura.RQL.Types.Metadata.Backend.BackendMetadata' type class instance for MSSQL.
|
2021-03-18 20:39:35 +03:00
|
|
|
module Hasura.Backends.MSSQL.Instances.Metadata () where
|
|
|
|
|
|
|
|
import Hasura.Backends.MSSQL.DDL qualified as MSSQL
|
2023-04-05 23:14:35 +03:00
|
|
|
import Hasura.Backends.MSSQL.Schema.Introspection qualified as MSSQL (listAllTables)
|
2023-05-16 19:28:03 +03:00
|
|
|
import Hasura.Base.Error (Code (UnexpectedPayload), throw400, throw500)
|
2023-06-13 20:20:25 +03:00
|
|
|
import Hasura.NativeQuery.InterpolatedQuery (trimQueryEnd)
|
|
|
|
import Hasura.NativeQuery.Metadata (NativeQueryMetadata (..))
|
2023-06-01 12:13:51 +03:00
|
|
|
import Hasura.NativeQuery.Validation (validateArgumentDeclaration)
|
2023-03-08 08:59:40 +03:00
|
|
|
import Hasura.Prelude
|
2023-04-26 09:48:12 +03:00
|
|
|
import Hasura.RQL.DDL.Relationship (defaultBuildArrayRelationshipInfo, defaultBuildObjectRelationshipInfo)
|
2023-04-24 21:35:48 +03:00
|
|
|
import Hasura.RQL.Types.BackendType
|
2021-03-18 20:39:35 +03:00
|
|
|
import Hasura.RQL.Types.Metadata.Backend
|
|
|
|
|
|
|
|
instance BackendMetadata 'MSSQL where
|
2022-05-05 16:43:50 +03:00
|
|
|
prepareCatalog = MSSQL.prepareCatalog
|
2021-03-18 20:39:35 +03:00
|
|
|
buildComputedFieldInfo = MSSQL.buildComputedFieldInfo
|
|
|
|
fetchAndValidateEnumValues = MSSQL.fetchAndValidateEnumValues
|
2022-09-05 05:42:59 +03:00
|
|
|
resolveSourceConfig = MSSQL.resolveSourceConfig
|
2023-04-13 04:29:15 +03:00
|
|
|
resolveDatabaseMetadata _ _ = MSSQL.resolveDatabaseMetadata
|
2021-03-18 20:39:35 +03:00
|
|
|
parseBoolExpOperations = MSSQL.parseBoolExpOperations
|
2023-04-26 09:48:12 +03:00
|
|
|
buildArrayRelationshipInfo _ = defaultBuildArrayRelationshipInfo
|
|
|
|
buildObjectRelationshipInfo _ = defaultBuildObjectRelationshipInfo
|
2021-03-18 20:39:35 +03:00
|
|
|
buildFunctionInfo = MSSQL.buildFunctionInfo
|
|
|
|
updateColumnInEventTrigger = MSSQL.updateColumnInEventTrigger
|
|
|
|
parseCollectableType = MSSQL.parseCollectableType
|
|
|
|
postDropSourceHook = MSSQL.postDropSourceHook
|
2022-05-25 13:24:41 +03:00
|
|
|
buildComputedFieldBooleanExp _ _ _ _ _ _ =
|
|
|
|
throw500 "Computed fields are not yet defined for MSSQL backends"
|
2023-03-08 08:59:40 +03:00
|
|
|
supportsBeingRemoteRelationshipTarget _ = True
|
2023-04-05 23:14:35 +03:00
|
|
|
listAllTables = MSSQL.listAllTables
|
2023-05-19 07:47:12 +03:00
|
|
|
listAllTrackables _ =
|
|
|
|
throw500 "Computed fields are not yet defined for MSSQL backends"
|
2023-05-16 19:28:03 +03:00
|
|
|
getTableInfo _ _ = throw400 UnexpectedPayload "get_table_info not yet supported in MSSQL!"
|
2023-08-17 05:03:45 +03:00
|
|
|
validateNativeQuery _ _ _ _ _ nq = do
|
2023-06-13 20:20:25 +03:00
|
|
|
validateArgumentDeclaration nq
|
|
|
|
pure (trimQueryEnd (_nqmCode nq)) -- for now, all queries are valid
|
2023-04-28 16:37:01 +03:00
|
|
|
validateStoredProcedure _ _ _ _ = pure () -- for now, all stored procedures are valid
|
2023-05-02 16:30:22 +03:00
|
|
|
getStoredProcedureGraphqlName = MSSQL.getStoredProcedureGraphqlName
|