Constructive Functions

Customer-authored database functions and trigger attachments through the SDK ORM — `db.function` rows (kind `sql` | `plpgsql` | `trigger`) with a validated AST body, `apiExposed` opt-in to the generated GraphQL API, and `db.trigger` rows (kind `attachment`) that fire a customer trigger function AFTER INSERT/UPDATE/DELETE FOR EACH ROW with an optional `whenAst`. Use when asked to 'add a database function', 'write a PL/pgSQL function', 'custom SQL function', 'expose a function in the API', 'add a trigger', 'attach a trigger function', 'run code when a row changes', 'bodyAst', 'whenAst', 'apiExposed', 'FUNCTION_NAME_CONFLICT', 'FUNCTION_SCHEMA_NOT_EXPOSABLE', 'TRIGGER_ATTACHMENT_FUNCTION_NOT_A_TRIGGER', or 'FUNCTION_ENVELOPE_VIOLATION'.

constructive-io Updated

File contents

constructive-io/constructive-skills/tree/main/.agents/skills/constructive-functions commit 438e6aeb5f

Frequently asked questions

npx skillmds@latest add constructive-io/constructive-functions