Docs

Player data & audit log

See everything the database holds about a player, correct a value, and roll a player back to an earlier moment.

Finding a player

The Players tab answers "what does the database hold about this player?". Search by citizen ID, licence or name, and the matching characters are listed. QBCore, Qbox and ESX are recognised; on any other setup you can search every table for an exact value.

Opening a player lists every table that holds rows with their ID, and the rows themselves.

Before you search, the page shows how many characters and accounts there are and how many are new or were seen in the last 7 days. Below that, On the server now lists the players who are connected, and Needs attention the players with a suspicious increase in the audit log. Click one to open their data.

How rows are found: every short text column (CHAR / VARCHAR) of every table is compared with the ID. It does not depend on column names or on a framework. IDs stored inside JSON, such as a list of key holders, are not found.

Edit, export, wipe

  • Edit changes one value of one row. Only tables with a primary key can be edited, and the primary key itself and binary data cannot. If the value changed after you opened it, the save is refused. The old value goes into the change log, and Undo puts it back as long as the value has not changed again.
  • Export writes all of the player's rows to one JSON file in waw-sql-data/exports on the server.
  • Wipe player deletes the player's rows from the tables you select. Those tables are backed up first ("before wipe" on the Backups tab), and you have to type the player's ID to confirm.
  • Include account rows also shows the rows stored under the player's licence: bans, whitelist, other characters of the same account.
Change data while the player is offline

A player who is on the server is marked. The framework keeps their data in memory and writes it back when it saves, which would overwrite your change.

Every edit, export and wipe is kept in the change log with the admin's name (waw-sql-data/explorer.json). The new value of an edit is never written to the console or to Discord.

Audit log

Under Players → Audit log you choose the tables that matter: characters, vehicles, bank accounts and so on. From then on the database itself records every change to them, whoever makes it: a script, an admin tool, or someone connected with HeidiSQL.

Three triggers are added to each audited table. They write the old and new values to the waw_sql_audit table. An UPDATE records only the columns that changed; a DELETE records the whole row so it can be brought back.

  • You choose which columns are recorded. Columns that change on every save (position, metadata, last update time) are left out by default, so the log does not grow for nothing.
  • A trigger can never break a script: any error inside it is ignored, so the script's own write always succeeds. At worst that one change is not recorded.
  • Records are deleted after 7 days (changeable), and the oldest are dropped if the table passes 2 million rows (waw_sql_audit_max_rows).
  • When an audited table is restored from a backup, or its columns change, the triggers are put back automatically (checked every 5 minutes and right after a restore).
  • Stop removes the triggers from a table. Nothing else about the table changes at any point.

The audit log needs tables with a primary key, and a database user allowed to create triggers. Settings and flags are stored in waw-sql-data/audit.json.

A player's history and rollback

Opening a player on the Players tab lists the recorded changes to their rows.

Roll back lets you pick how far to go back, from 15 minutes up to 7 days. waw-sql works out, row by row, what the player's audited rows looked like at that moment: changed values are restored, deleted rows come back, rows added since are removed.

  1. You see the full list of changes first.
  2. Applying it needs the player's ID typed in.
  3. The affected tables are backed up before anything is written ("before rollback" on the Backups tab).

Only recorded columns can be restored. The rollback itself is recorded too, so it can be rolled back.

Suspicious increases

When a number rises by 1,000,000 or more in a single change (the amount is yours to set), the change is flagged on the Audit log page and, with the Discord log on, sent to the channel. Numbers inside JSON are checked as well, so money.bank in a QBCore players row is covered.