Skip to content

v1.0.34 — Tables keep their change history

Latest

Choose a tag to compare

@github-actions github-actions released this 30 Nov 20:52

Tables can now record their change history. Set audit on a table() and Xano keeps every insert, update and delete in a read-only log your function stacks read with auditLog(). Studio workspaces that already audit tables now pull into code that compiles and deploys back with that history intact.

npm install @xano/sdk@1.0.34

table({ audit }) records every change to a table

audit: { mask, exclude } turns on Xano's audit history for a table. mask records that a field changed without its value, and exclude leaves a field out. A name in either list that matches no field fails the export, so a typo can't record the value it was meant to hide. Never declare the <table>_audit log yourself: the deploy adds it. enabled: false stops recording and keeps the history readable.

auditLog(table) reads the history, and nothing can write to it

s.db.query({ table: auditLog(customer), sort: [{ sortBy: "id", dir: "desc" }], as: "changes" })

Rows are typed with the log's fields (op, record_id, changed, old, new, source, user, endpoint). A write to a log fails before deploy, as does a trigger or auth table bound to one.

Pulling a workspace with audited tables works

Before, init --from / pull turned an audited table's log into an ordinary table that failed to compile ("a system: false table still needs an id primary key"), and dropped the table's audit setting. Now the setting is kept on the table, reads of the log come back as auditLog(table), and the log keeps its identity across deploy --keep-data and lock rename.

The guides and CLI messages match what the CLI does today

Every guide was checked against the code and corrected: named static hosts, site defaults, pull sources, projects on their own xano/data, s.db.increment, call result types, leaving microservices out, and more. local update no longer says a project on its own xano/data restarts empty, and an unknown --static-host now points to site use <name> --create. The sandbox examples now cover audit logs, s.mcp.progress and 20 more filters.

Notes

  • Removing audit, or deleting an audited table, deletes its log on the next deploy. Use enabled: false to stop recording and keep the history.
  • A log whose table was deleted, or one Xano had to rename to <table>_audit_<id>, can't be carried. The pull reports it with the fix.
  • Recording needs a Xano plan that includes auditing.