Threadline.Semantics.AuditAction (Threadline v0.2.0)

Copy Markdown View Source

Ecto schema for the audit_actions table.

An AuditAction represents a semantic application-level event — who did what and why. It is distinct from AuditTransaction (which groups DB-level row changes produced by triggers) and may be linked to one or more transactions via audit_transactions.action_id.

Name convention

Action names use the "<category>.<verb>" pattern, for example:

  • "member.role_changed"
  • "order.placed"
  • "account.deactivated"
  • "document.archived"

The :category and :verb fields store the components separately so you can filter by either dimension in queries.

Usage

Create actions via Threadline.record_action/2, which inserts the semantic row using the provided :repo. Linking captured transactions to an action is handled separately when you associate audit_transactions.action_id.