graphql-engine/server/src-lib/Hasura/Server
Karthikeyan Chinnakonda 32a316aef7 server: provide an option to enable event triggers on logically replicated tables
## Description ✍️
This PR introduces a new feature to enable/disable event triggers during logical replication of table data for PostgreSQL and MS-SQL data sources. We introduce a new field `trigger_on_replication` in the `*_create_event_trigger` metadata API. By default the event triggers will not fire for logical data replication.

## Changelog ✍️

__Component__ : server

__Type__: feature

__Product__: community-edition

### Short Changelog

Add option to enable/disable event triggers on logically replicated tables

### Related Issues ✍

https://github.com/hasura/graphql-engine/issues/8814
https://hasurahq.atlassian.net/browse/GS-252

### Solution and Design
- By default, triggers do **not** fire when the session mode is `replica` in Postgres, so if the `triggerOnReplication` is set to `true` for an event trigger we run the query `ALTER TABLE #{tableTxt} ENABLE ALWAYS TRIGGER #{triggerNameTxt};` so that the trigger fires always irrespective of the `session_replication_role`
- By default, triggers do fire in case of replication in MS-SQL, so if the `triggerOnReplication` is set to `false` for an event trigger we add a clause `NOT FOR REPLICATION` to the the SQL when the trigger is created/altered, which sets the `is_not_for_replication` for the trigger as `true` and it does not fire during logical replication.

### Steps to test and verify ✍
- Run hspec integration tests for HGE

## Server checklist ✍

### Metadata ✍

Does this PR add a new Metadata feature?
-  Yes
  - Does `export_metadata`/`replace_metadata` supports the new metadata added?
    - 

PR-URL: https://github.com/hasura/graphql-engine-mono/pull/6953
Co-authored-by: Puru Gupta <32328846+purugupta99@users.noreply.github.com>
Co-authored-by: Sean Park-Ross <94021366+seanparkross@users.noreply.github.com>
GitOrigin-RevId: 92731328a2bbdcad2302c829f26f9acb33c36135
2022-11-29 17:43:13 +00:00
..
API server: update metadata api for the OpenTelemetry exporter 2022-11-23 07:54:53 +00:00
Auth ghc 9.2.5 2022-11-15 11:26:42 +00:00
Init Further schema cache cleanups 2022-11-29 01:02:09 +00:00
Migrate server: provide an option to enable event triggers on logically replicated tables 2022-11-29 17:43:13 +00:00
Telemetry Upgrade Ormolu to v0.5. 2022-11-02 20:55:13 +00:00
App.hs server: add default naming convention to ServerConfig 2022-11-21 05:05:14 +00:00
Auth.hs Upgrade Ormolu to v0.5. 2022-11-02 20:55:13 +00:00
CheckUpdates.hs Upgrade Ormolu to v0.5. 2022-11-02 20:55:13 +00:00
Compression.hs benchmarks: Add Accept-Encoding: gzip headers (NO REGRESSION) 2022-08-25 06:43:18 +00:00
Cors.hs Upgrade Ormolu to v0.5. 2022-11-02 20:55:13 +00:00
Init.hs Support MetadataDefaults Options - GDC-108 2022-10-20 12:46:45 +00:00
Limits.hs server: do not apply default tenant time limits to Hasura EE 2022-10-27 15:37:00 +00:00
Logging.hs server: more adjustments to metadata sync logging 2022-11-05 22:38:22 +00:00
MetadataOpenAPI.hs server: codecs for TableMetadata, FunctionMetadata, and permissions 2022-09-12 20:31:07 +00:00
Metrics.hs server: rename event trigger metric hasura_event_processing_time_seconds to hasura_event_webhook_processing_time_seconds 2022-11-21 07:49:28 +00:00
Middleware.hs server: assorted minor clean-up around HTTP managers 2022-02-16 07:09:47 +00:00
Migrate.hs pro-server: add support for exporting traces over OTLP 2022-11-07 06:56:08 +00:00
Name.hs server: Reorganize quasi-quoted names. 2022-06-23 09:15:31 +00:00
OpenAPI.hs Rewrite OpenAPI 2022-06-30 12:57:09 +00:00
Prometheus.hs server: rename event trigger metric hasura_event_processing_time_seconds to hasura_event_webhook_processing_time_seconds 2022-11-21 07:49:28 +00:00
Rest.hs Upgrade Ormolu to v0.5. 2022-11-02 20:55:13 +00:00
SchemaCacheRef.hs Upgrade Ormolu to v0.5. 2022-11-02 20:55:13 +00:00
SchemaUpdate.hs server: more adjustments to metadata sync logging 2022-11-05 22:38:22 +00:00
Telemetry.hs Upgrade Ormolu to v0.5. 2022-11-02 20:55:13 +00:00
Types.hs [server]: feature flag to remove _stream fields from schema 2022-11-04 13:10:35 +00:00
Utils.hs Upgrade Ormolu to v0.5. 2022-11-02 20:55:13 +00:00
Version.hs Amend console assets versioning scheme for CE 2022-08-26 12:39:16 +00:00