---
title: auditIfChanged
description: >-
  The statement that appends `entry` only when the statement just before it in
  the batch changed a row, for a change whose own guard may leave it undone. Its
  results hold the entry's id when it appended one, and nothing otherwise, so
  the batch's last result says whether the change happened.
updated_at: '2026-11-19T12:10:41+01:00'
created_at: '2026-11-19T06:37:33+01:00'
symbol:
  kind: function
  name: auditIfChanged
  signatures:
    - >-
      auditIfChanged(db: Database, options:
      [[reference/api/auth/server/AuditEntry|AuditEntry]]): Statement
  parameters:
    - name: db
      type: Database
    - name: options
      type: '[[reference/api/auth/server/AuditEntry|AuditEntry]]'
  returns:
    type: Statement
  source: >-
    https://github.com/mia-cx/svartz/blob/711f3906a713c8b9a5a572d0f34c85e90c3bc3d1/packages/auth/src/audit.ts#L32
---

# auditIfChanged
