How to run AFTER INSERT TRIGGER after related objects are inserted. #7669
Unanswered
pijablonski
asked this question in
Question
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
Setup: Hasura 2.0.9 on PostgreSQL 13.3.
Using example from Hasura Docs to model my task:
Let’s say an author has an array relationship called articles to the articles table and some other similar array relationships to different tables.
I am inserting an author object along with its related objects through relationships.
Now, what I want to do, is to run single
do_something_for_new_author_function(INSERTED_OBJECT)
, but I want to do it after all relationship objects are inserted.From Hasura docs:
So I cannot just define an AFTER INSERT TRIGGER on author, as it would run between steps 1 and 2.
On the other hand,
do_something_for_new_author_function
should run within the same transaction as insert mutation(s).So... How do I acheive this?
Just in case it matters - I am using
insert_one
type of mutation for now.Beta Was this translation helpful? Give feedback.
All reactions