mirror of
https://github.com/hasura/graphql-engine.git
synced 2024-12-17 12:31:52 +03:00
15 lines
423 B
Plaintext
15 lines
423 B
Plaintext
|
CREATE OR ALTER TRIGGER #{qualifiedTriggerName}
|
||
|
ON #{qualifiedTableName}
|
||
|
AFTER DELETE
|
||
|
AS
|
||
|
BEGIN
|
||
|
DECLARE @json NVARCHAR(MAX)
|
||
|
SET @json = (
|
||
|
SELECT #{deliveryColsSQLExpression}, NULL as [data.new]
|
||
|
FROM DELETED
|
||
|
FOR JSON PATH, INCLUDE_NULL_VALUES
|
||
|
)
|
||
|
insert into hdb_catalog.event_log (schema_name,table_name,trigger_name,payload)
|
||
|
select '#{schemaName}','#{tableName}','#{triggerNameText}', value from OPENJSON (@json)
|
||
|
END;
|