Turn a function's trigger on the branch on or off
Turning a table trigger off uninstalls it from the database and drops its queued events; turning it on installs it again (pending_install).
Authorization
bearer In: header
Path Parameters
Database id
uuidBranch id
uuidFunction name
Trigger id
uuidRequest Body
application/json
TypeScript Definitions
Use the request body type in TypeScript.
Response Body
application/json
application/json
application/json
application/json
application/json
application/json
application/json
application/json
curl -X PATCH "https://example.com/v1/databases/497f6eca-6276-4993-bfeb-53cbbbba6f08/branches/497f6eca-6276-4993-bfeb-53cbbbba6f08/functions/string/triggers/497f6eca-6276-4993-bfeb-53cbbbba6f08" \ -H "Content-Type: application/json" \ -d '{ "enabled": true }'{ "bucket": "string", "dead_count": 0, "dropped_count": 0, "enabled": true, "events": [ "string" ], "id": "497f6eca-6276-4993-bfeb-53cbbbba6f08", "last_delivered_at": "2019-08-24T14:15:22Z", "last_delivery_error": "string", "last_error": "string", "pg_database": "string", "prefix": "string", "schema": "string", "source": "table", "state": "string", "table": "string"}Add a trigger to a function on the branch POST
A `table` trigger is installed in the branch's database by the worker (`pending_install`, then `installed` or `failed`); each committed matching row change is then POSTed to the function's `fetch` handler with header `chelabase-event: db` and body `{id, type, schema, table, record, old_record, txid}` (over 256 KiB: `record` and `old_record` null, `truncated: true` and `primary_key`). Delivery is at least once (dedupe on `id`): a non-2xx answer is retried with backoff, and the 10th failure makes the event dead (`dead_count`). Events queue while the function is disabled; a pending event is never dropped, and dead events past 10,000 per database or 7 days are removed and counted (`dropped_count`). The database's compute stays awake while it has an installed table trigger. A `storage` trigger starts `installed`. A new branch inherits the triggers.
Delete a function's trigger on the branch DELETE
No event is delivered for it from now on; the worker drops its database trigger and queued events.