Database
On this page6
The script creates and updates its own tables. You do not import anything.
It is automatic
At every start the script does this:
- It runs
sql/install.sqlfrom its own folder. Tables that are missing are created. Tables that exist are left alone. - It adds columns that a newer version needs, but only when they are missing.
- When there are no ranks yet (the first start), it creates the default ranks from
Config.DefaultRanks. - After an update with new permissions, it gives them to the default ranks. This happens once (see Updating).
Then the console shows:
[5code-adminpanel] database ready.Shortly after that, and then once a day, the script deletes old log lines. See Old log lines.
The tables
Eighteen tables. All names start with adminpanel_.
Ranks and staff
| Table | What it holds |
|---|---|
adminpanel_ranks | The ranks: name, power and permissions. |
adminpanel_staff | Which player holds which rank. |
adminpanel_staff_seen | Name and rank of every staff member the panel has seen. Lists use it to show a name, for example under "Banned by". |
Bans, warnings and jail
| Table | What it holds |
|---|---|
adminpanel_bans | Every ban: the player, the reason, who banned, until when, and whether it was revoked. |
adminpanel_warns | Every warning: the player, the reason, who warned, and whether it was revoked. |
adminpanel_jail | Players who are in admin jail right now: time left, reason, and where to put them back. |
Tickets and sits
| Table | What it holds |
|---|---|
adminpanel_reports | The tickets: who opened them, who handles them, open or resolved. |
adminpanel_report_messages | The conversation of each ticket. |
adminpanel_report_people | The people of a ticket: the reporter and the players staff added. |
adminpanel_sit_positions | Where each person stood before a sit, so they can be put back. |
Players
| Table | What it holds |
|---|---|
adminpanel_activity | One row per player: first seen, last login, last seen, playtime and their identifiers. |
adminpanel_player_notes | Staff notes and alerts on players. |
Logs and statistics
| Table | What it holds |
|---|---|
adminpanel_logs | The log: staff actions, bans, warnings, kicks, tickets, joins and leaves. Lines older than Config.LogKeepDays days (default 90) are removed by the script. |
adminpanel_stats_daily | The highest number of players and staff online, per day. |
adminpanel_stats_hourly | Players and staff online, per hour of the day. |
adminpanel_stats_seen | Which players were online, per day. Rows older than 120 days are removed by the script. |
adminpanel_stats_first_seen | The first day each player was seen. The dashboard uses it for "new players". |
Housekeeping
| Table | What it holds |
|---|---|
adminpanel_meta | Small notes the script keeps for itself, for example which one-time update is already done. |
Good to know
- Players are stored by their Rockstar license. A ban, a warning, a note or a rank follows the person, whatever character they play.
- IP addresses are not stored.
- Your framework's tables are only read. The offline search and the offline profile read the player
table of your framework (
playerson QBCore and Qbox,userson ESX). The script does not write to it. Money, jobs and items are changed through your framework and your inventory, like any other script does. - Nothing is dropped. The script never deletes a table or a column, also not in an update.
Old log lines
adminpanel_logs also holds every join and leave, so it grows on a busy server. The script cleans
it by itself.
Key in config.lua | Default | Meaning |
|---|---|---|
Config.LogKeepDays | 90 | Log lines older than this many days are deleted. 0 keeps everything. |
- The clean-up runs shortly after every start, then once a day.
- It only touches
adminpanel_logs. Bans, warnings and tickets are in their own tables and are never deleted. - A
config.luawithout the line counts as90. - When lines were deleted, the console shows for example:
[5code-adminpanel] logs: 1250 line(s) older than 90 day(s) deleted. - The dashboard statistics read the last 90 days of the log. With a smaller value, older days show smaller numbers. See Dashboard.
The setting is explained on General.
Backups
Export every table that starts with adminpanel_. With HeidiSQL or phpMyAdmin: select the tables and use
Export. On a command line:
mysqldump -u YOUR_DB_USER -p YOUR_DB_NAME > backup.sqlThat command saves the whole database, including the panel's tables.
Updates
An update changes the database by itself at the first start. What exactly happens is on the Updating page.