graphql-engine-1.0.0: GraphQL API over Postgres
Safe HaskellNone
LanguageHaskell2010

Hasura.Backends.MSSQL.DDL.EventTrigger

Synopsis

Documentation

fetchEvents :: SourceName -> [TriggerName] -> FetchBatchSize -> TxE QErr [Event 'MSSQL] Source #

Lock and return events not yet being processed or completed, up to some limit. Process events approximately in created_at order, but we make no ordering guarentees; events can and will race. Nevertheless we want to ensure newer change events don't starve older ones.

convertUTCToDatetime2 :: MonadIO m => UTCTime -> m Datetime2 Source #

Note: UTCTIME not supported in SQL Server

Refer 'ToSql UTCTIME' instance of odbc package: https://github.com/fpco/odbc/blob/f4f04ea15d14e9a3ed455f7c728dc08734eef8ae/src/Database/ODBC/SQLServer.hs#L377

We use SYSDATETIMEOFFSET() to store time values along with it's time zone offset in event_log table. Since ODBC server does not support time zones, we use a workaround.

We wrap the time value in Datetime2, but before we insert it into the event_log table we convert it into UTCTIME using the 'TODATETIMEOFFSET()' sql function.

newtype SQLFragment Source #

Store a fragment of SQL expression

Constructors

SQLFragment 

Fields

checkSpatialDataTypeColumns :: MonadMSSQLTx m => [ColumnInfo 'MSSQL] -> SubscribeOpSpec 'MSSQL -> m () Source #

Currently we do not support Event Triggers on columns of Spatial data types. We do this because, currently the graphQL API for these types is broken for MSSQL sources. Ref: https://github.com/hasura/graphql-engine-mono/issues/787

isPrimaryKeyInListenColumns :: [ColumnInfo 'MSSQL] -> PrimaryKey 'MSSQL (ColumnInfo 'MSSQL) -> SQLFragment Source #

Check if primary key is present in listen columns We use this in update event trigger, to check if the primary key has been updated and construct the payload accordingly.