graphql-engine/server/src-lib/Hasura/Backends/BigQuery
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
..
DDL Upgrade Ormolu to v0.5. 2022-11-02 20:55:13 +00:00
Instances server: provide an option to enable event triggers on logically replicated tables 2022-11-29 17:43:13 +00:00
Parser Upgrade Ormolu to v0.5. 2022-11-02 20:55:13 +00:00
Connection.hs Remove strictness annotations from data types in the Hasura.Backends hierarchy 2022-07-29 14:06:23 +00:00
DDL.hs Move MkTypename and NamingCase into their own modules. 2022-07-12 14:01:28 +00:00
Execute.hs Upgrade Ormolu to v0.5. 2022-11-02 20:55:13 +00:00
FromIr.hs Upgrade Ormolu to v0.5. 2022-11-02 20:55:13 +00:00
Meta.hs Further schema cache cleanups 2022-11-29 01:02:09 +00:00
Name.hs server: Reorganize quasi-quoted names. 2022-06-23 09:15:31 +00:00
Plan.hs Move Hasura.GraphQL.Parser.Column to .RQL.IR. and .GraphQL.Schema. 2022-05-30 22:07:57 +00:00
Source.hs server: delete the Cacheable type class in favor of Eq 2022-11-21 16:35:37 +00:00
ToQuery.hs Upgrade Ormolu to v0.5. 2022-11-02 20:55:13 +00:00
Types.hs server: delete the Cacheable type class in favor of Eq 2022-11-21 16:35:37 +00:00