mirror of
https://github.com/DarkflameUniverse/DarkflameServer.git
synced 2026-10-02 10:53:44 +00:00
chat_log gets guild_id, team_id and filtered (migrations mysql 100, sqlite 83), and the chat log queries take a time range, a guild, a team, a conversation between two characters and paging back by id. Whispers are their own visibility switch (includeWhispers), apart from team and guild chat (includePrivate). Whisper partners and teams that talked are listed with counts. chat_flags, chat_flag_messages and chat_flag_events (mysql 101, sqlite 84) hold flagged chat with a copy of the messages around it, its status, note, linked player report and history. Open flags are in the dashboard snapshot. Tests on SQLite alone (dDatabaseSqliteTests) and in the MySQL parity tests. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
47 lines
2.0 KiB
SQL
47 lines
2.0 KiB
SQL
/* Chat messages staff flagged for review (the dashboard's Chat Flags page). status: open, actioned or dismissed.
|
|
character_id/account_id: who the flag is about. messages: JSON copy of the flagged messages and the chat around them,
|
|
kept after chat_log prunes them. player_report_id: a player report the flag goes with (0: none).
|
|
chat_flag_messages: which chat_log rows a flag covers. chat_flag_events: who did what with a flag. */
|
|
CREATE TABLE IF NOT EXISTS chat_flags (
|
|
id BIGINT UNSIGNED NOT NULL AUTO_INCREMENT PRIMARY KEY,
|
|
created_at BIGINT NOT NULL,
|
|
created_by_id INT UNSIGNED NOT NULL DEFAULT 0,
|
|
created_by VARCHAR(64) NOT NULL DEFAULT '',
|
|
status VARCHAR(16) NOT NULL DEFAULT 'open',
|
|
channel VARCHAR(16) NOT NULL,
|
|
character_id BIGINT NOT NULL DEFAULT 0,
|
|
character_name VARCHAR(64) NOT NULL DEFAULT '',
|
|
account_id INT UNSIGNED NOT NULL DEFAULT 0,
|
|
first_message_id BIGINT UNSIGNED NOT NULL DEFAULT 0,
|
|
last_message_id BIGINT UNSIGNED NOT NULL DEFAULT 0,
|
|
first_time BIGINT NOT NULL DEFAULT 0,
|
|
last_time BIGINT NOT NULL DEFAULT 0,
|
|
excerpt VARCHAR(512) NOT NULL DEFAULT '',
|
|
note TEXT NOT NULL,
|
|
messages MEDIUMTEXT NOT NULL,
|
|
player_report_id BIGINT UNSIGNED NOT NULL DEFAULT 0,
|
|
updated_at BIGINT NOT NULL DEFAULT 0,
|
|
updated_by VARCHAR(64) NOT NULL DEFAULT '',
|
|
INDEX chat_flags_status (status),
|
|
INDEX chat_flags_character (character_id),
|
|
INDEX chat_flags_account (account_id)
|
|
);
|
|
|
|
CREATE TABLE IF NOT EXISTS chat_flag_messages (
|
|
flag_id BIGINT UNSIGNED NOT NULL,
|
|
message_id BIGINT UNSIGNED NOT NULL,
|
|
PRIMARY KEY (flag_id, message_id),
|
|
INDEX chat_flag_messages_message (message_id)
|
|
);
|
|
|
|
CREATE TABLE IF NOT EXISTS chat_flag_events (
|
|
id BIGINT UNSIGNED NOT NULL AUTO_INCREMENT PRIMARY KEY,
|
|
flag_id BIGINT UNSIGNED NOT NULL,
|
|
time BIGINT NOT NULL,
|
|
account_id INT UNSIGNED NOT NULL DEFAULT 0,
|
|
actor VARCHAR(64) NOT NULL DEFAULT '',
|
|
action VARCHAR(16) NOT NULL,
|
|
detail TEXT NOT NULL,
|
|
INDEX chat_flag_events_flag (flag_id)
|
|
);
|