Allow for columns without known types in MS SQL Server.

Sometimes, the `sys.types` table will not contain a type for a given column.

PR-URL: https://github.com/hasura/graphql-engine-mono/pull/10506
GitOrigin-RevId: 7407e715a75d196f1bc0408d05f00804f85cbc55
This commit is contained in:
Samir Talwar 2023-11-23 11:30:50 +01:00 committed by hasura-bot
parent 1b7f2451ca
commit d39f30c38c

View File

@ -95,7 +95,7 @@ data SysColumn = SysColumn
scIsNullable :: Bool,
scIsIdentity :: Bool,
scIsComputed :: Bool,
scJoinedSysType :: SysType,
scJoinedSysType :: Maybe SysType,
scJoinedForeignKeyColumns :: [SysForeignKeyColumn]
}
deriving (Show, Generic)
@ -166,7 +166,7 @@ transformColumn sysCol =
rciIsNullable = scIsNullable sysCol
rciDescription = Nothing
rciType = RawColumnTypeScalar $ parseScalarType $ styName $ scJoinedSysType sysCol
rciType = maybe (RawColumnTypeScalar (UnknownType (tshow (scUserTypeId sysCol)))) (RawColumnTypeScalar . parseScalarType . styName) $ scJoinedSysType sysCol
foreignKeys =
scJoinedForeignKeyColumns sysCol <&> \foreignKeyColumn ->
let _fkConstraint = Constraint (ConstraintName "fk_mssql") $ OID $ sfkcConstraintObjectId foreignKeyColumn