Home / Companies / Hasura / Blog / Post Details
Content Deep Dive

Postgres triggers on GraphQL mutations

Blog post from Hasura

Post Details
Company
Date Published
Author
Anon Ray
Word Count
507
Language
English
Hacker News Points
-
Summary

Postgres triggers can be used to perform backend operations like validation and inserting/updating related data whenever inserts or updates occur on tables. These triggers are associated with a table or view and are fired when an event such as INSERT, DELETE, UPDATE, or TRUNCATE takes place. Triggers can be invoked before, after, or instead of the operation. They can be used for server-side validation and inserting related data in a single transaction. For example, in a banking application, triggers can ensure that deposit amounts are valid and greater than zero, and in a note-taking app, they can create revisions whenever a note is updated.