mirror of
https://github.com/DarkflameUniverse/DarkflameServer.git
synced 2026-10-13 00:03:45 +00:00
feat: web dashboard and playground work
The NexusDashboard-parity dashboard (dDashboardServer) and everything built on it on the experimental branch: accounts, characters, properties and moderation tools, permissions shared with in-game slash commands, economy reports, World 3D and property 3D views with client scenery, scheduled events (features, vanity changes, live events, announcements, restarts), vanity files and events, the CDClient browser, the message inspector with saved captures, chat filter tools, community challenges, live ops, the AI moderator helper, and the server-side changes they need. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
6
migrations/dlu/sqlite/10_login_tracking.sql
Normal file
6
migrations/dlu/sqlite/10_login_tracking.sql
Normal file
@@ -0,0 +1,6 @@
|
||||
/* Migration: Add login tracking columns to accounts table */
|
||||
/* Adds fields for tracking login attempts, lockouts, and last login */
|
||||
|
||||
ALTER TABLE accounts ADD COLUMN failed_attempts INTEGER NOT NULL DEFAULT 0;
|
||||
ALTER TABLE accounts ADD COLUMN lockout_time DATETIME DEFAULT NULL;
|
||||
ALTER TABLE accounts ADD COLUMN last_login DATETIME DEFAULT NULL;
|
||||
8
migrations/dlu/sqlite/11_audit_log.sql
Normal file
8
migrations/dlu/sqlite/11_audit_log.sql
Normal file
@@ -0,0 +1,8 @@
|
||||
CREATE TABLE IF NOT EXISTS audit_log (
|
||||
id INTEGER NOT NULL PRIMARY KEY AUTOINCREMENT,
|
||||
account_id INTEGER NOT NULL DEFAULT 0,
|
||||
account_name TEXT NOT NULL DEFAULT '',
|
||||
action TEXT NOT NULL,
|
||||
description TEXT NOT NULL DEFAULT '',
|
||||
timestamp BIGINT NOT NULL DEFAULT 0
|
||||
);
|
||||
5
migrations/dlu/sqlite/12_dashboard_moderation.sql
Normal file
5
migrations/dlu/sqlite/12_dashboard_moderation.sql
Normal file
@@ -0,0 +1,5 @@
|
||||
/* Columns used by the web dashboard. Names match NexusDashboard. */
|
||||
ALTER TABLE play_keys ADD COLUMN notes TEXT DEFAULT NULL;
|
||||
ALTER TABLE bug_reports ADD COLUMN resolved_time DATETIME DEFAULT NULL;
|
||||
ALTER TABLE bug_reports ADD COLUMN resoleved_by_id INTEGER DEFAULT NULL;
|
||||
ALTER TABLE bug_reports ADD COLUMN resolution TEXT DEFAULT NULL;
|
||||
13
migrations/dlu/sqlite/13_account_email.sql
Normal file
13
migrations/dlu/sqlite/13_account_email.sql
Normal file
@@ -0,0 +1,13 @@
|
||||
/* Account email for password resets. Column names match NexusDashboard. */
|
||||
ALTER TABLE accounts ADD COLUMN email TEXT DEFAULT '';
|
||||
ALTER TABLE accounts ADD COLUMN email_confirmed_at DATETIME DEFAULT NULL;
|
||||
/* Sessions issued before this unix time are rejected, e.g. after a password reset */
|
||||
ALTER TABLE accounts ADD COLUMN sessions_valid_after BIGINT NOT NULL DEFAULT 0;
|
||||
CREATE TABLE IF NOT EXISTS account_tokens (
|
||||
token_hash TEXT NOT NULL PRIMARY KEY,
|
||||
account_id INTEGER NOT NULL,
|
||||
purpose TEXT NOT NULL,
|
||||
data TEXT NOT NULL DEFAULT '',
|
||||
expires_at BIGINT NOT NULL
|
||||
);
|
||||
CREATE INDEX IF NOT EXISTS account_tokens_account ON account_tokens (account_id, purpose);
|
||||
57
migrations/dlu/sqlite/14_economy_ledger.sql
Normal file
57
migrations/dlu/sqlite/14_economy_ledger.sql
Normal file
@@ -0,0 +1,57 @@
|
||||
/* Economy ledger for dashboard reports. See the MySQL migration for details. */
|
||||
CREATE TABLE IF NOT EXISTS economy_currency_daily (
|
||||
day INTEGER NOT NULL,
|
||||
character_id BIGINT NOT NULL,
|
||||
source INTEGER NOT NULL,
|
||||
gained BIGINT NOT NULL DEFAULT 0,
|
||||
spent BIGINT NOT NULL DEFAULT 0,
|
||||
PRIMARY KEY (day, character_id, source)
|
||||
);
|
||||
CREATE INDEX IF NOT EXISTS economy_currency_character ON economy_currency_daily (character_id, day);
|
||||
CREATE TABLE IF NOT EXISTS economy_uscore_daily (
|
||||
day INTEGER NOT NULL,
|
||||
character_id BIGINT NOT NULL,
|
||||
source INTEGER NOT NULL,
|
||||
gained BIGINT NOT NULL DEFAULT 0,
|
||||
lost BIGINT NOT NULL DEFAULT 0,
|
||||
PRIMARY KEY (day, character_id, source)
|
||||
);
|
||||
CREATE TABLE IF NOT EXISTS economy_items_daily (
|
||||
day INTEGER NOT NULL,
|
||||
lot INTEGER NOT NULL,
|
||||
source INTEGER NOT NULL,
|
||||
gm INTEGER NOT NULL DEFAULT 0,
|
||||
created BIGINT NOT NULL DEFAULT 0,
|
||||
destroyed BIGINT NOT NULL DEFAULT 0,
|
||||
PRIMARY KEY (day, lot, source, gm)
|
||||
);
|
||||
CREATE INDEX IF NOT EXISTS economy_items_lot ON economy_items_daily (lot, day);
|
||||
CREATE TABLE IF NOT EXISTS economy_transfers (
|
||||
id INTEGER NOT NULL PRIMARY KEY AUTOINCREMENT,
|
||||
time BIGINT NOT NULL,
|
||||
method INTEGER NOT NULL,
|
||||
item_id BIGINT NOT NULL DEFAULT 0,
|
||||
new_item_id BIGINT NOT NULL DEFAULT 0,
|
||||
lot INTEGER NOT NULL DEFAULT 0,
|
||||
count INTEGER NOT NULL DEFAULT 0,
|
||||
coins BIGINT NOT NULL DEFAULT 0,
|
||||
from_character BIGINT NOT NULL DEFAULT 0,
|
||||
to_character BIGINT NOT NULL DEFAULT 0,
|
||||
zone INTEGER NOT NULL DEFAULT 0
|
||||
);
|
||||
CREATE INDEX IF NOT EXISTS economy_transfers_item ON economy_transfers (item_id);
|
||||
CREATE INDEX IF NOT EXISTS economy_transfers_new_item ON economy_transfers (new_item_id);
|
||||
CREATE INDEX IF NOT EXISTS economy_transfers_from ON economy_transfers (from_character, time);
|
||||
CREATE INDEX IF NOT EXISTS economy_transfers_to ON economy_transfers (to_character, time);
|
||||
CREATE TABLE IF NOT EXISTS map_events_daily (
|
||||
day INTEGER NOT NULL,
|
||||
zone INTEGER NOT NULL,
|
||||
kind INTEGER NOT NULL,
|
||||
lot INTEGER NOT NULL,
|
||||
cell_x INTEGER NOT NULL,
|
||||
cell_z INTEGER NOT NULL,
|
||||
events BIGINT NOT NULL DEFAULT 0,
|
||||
quantity BIGINT NOT NULL DEFAULT 0,
|
||||
PRIMARY KEY (zone, kind, day, lot, cell_x, cell_z)
|
||||
);
|
||||
ALTER TABLE mail ADD COLUMN attachment_config TEXT DEFAULT NULL;
|
||||
46
migrations/dlu/sqlite/15_dashboard_alerts.sql
Normal file
46
migrations/dlu/sqlite/15_dashboard_alerts.sql
Normal file
@@ -0,0 +1,46 @@
|
||||
/* Outgoing webhooks, economy anomaly flags, dashboard state and two-factor login. See the MySQL migration. */
|
||||
CREATE TABLE IF NOT EXISTS dashboard_webhooks (
|
||||
id INTEGER NOT NULL PRIMARY KEY AUTOINCREMENT,
|
||||
name TEXT NOT NULL,
|
||||
url TEXT NOT NULL,
|
||||
format TEXT NOT NULL DEFAULT 'discord',
|
||||
events TEXT NOT NULL,
|
||||
secret TEXT NOT NULL DEFAULT '',
|
||||
enabled INTEGER NOT NULL DEFAULT 1,
|
||||
created_at BIGINT NOT NULL,
|
||||
last_sent_at BIGINT NOT NULL DEFAULT 0,
|
||||
last_status INTEGER NOT NULL DEFAULT 0,
|
||||
last_error TEXT NULL
|
||||
);
|
||||
CREATE TABLE IF NOT EXISTS economy_flags (
|
||||
id INTEGER NOT NULL PRIMARY KEY AUTOINCREMENT,
|
||||
created_at BIGINT NOT NULL,
|
||||
day INTEGER NOT NULL,
|
||||
kind INTEGER NOT NULL,
|
||||
character_id BIGINT NOT NULL DEFAULT 0,
|
||||
lot INTEGER NOT NULL DEFAULT 0,
|
||||
item_id BIGINT NOT NULL DEFAULT 0,
|
||||
value BIGINT NOT NULL DEFAULT 0,
|
||||
baseline BIGINT NOT NULL DEFAULT 0,
|
||||
details TEXT NULL,
|
||||
status INTEGER NOT NULL DEFAULT 0,
|
||||
reviewed_by INTEGER NOT NULL DEFAULT 0,
|
||||
reviewed_at BIGINT NOT NULL DEFAULT 0,
|
||||
note TEXT NULL,
|
||||
UNIQUE (kind, day, character_id, lot, item_id)
|
||||
);
|
||||
CREATE INDEX IF NOT EXISTS economy_flags_status ON economy_flags (status, id);
|
||||
CREATE TABLE IF NOT EXISTS dashboard_state (
|
||||
name TEXT NOT NULL PRIMARY KEY,
|
||||
value TEXT NOT NULL
|
||||
);
|
||||
ALTER TABLE accounts ADD COLUMN totp_secret TEXT NULL;
|
||||
ALTER TABLE accounts ADD COLUMN totp_enabled_at BIGINT NOT NULL DEFAULT 0;
|
||||
ALTER TABLE accounts ADD COLUMN totp_last_step BIGINT NOT NULL DEFAULT 0;
|
||||
CREATE TABLE IF NOT EXISTS account_recovery_codes (
|
||||
id INTEGER NOT NULL PRIMARY KEY AUTOINCREMENT,
|
||||
account_id INTEGER NOT NULL,
|
||||
code_hash TEXT NOT NULL,
|
||||
used_at BIGINT NOT NULL DEFAULT 0
|
||||
);
|
||||
CREATE INDEX IF NOT EXISTS account_recovery_codes_account ON account_recovery_codes (account_id);
|
||||
4
migrations/dlu/sqlite/16_log_retention.sql
Normal file
4
migrations/dlu/sqlite/16_log_retention.sql
Normal file
@@ -0,0 +1,4 @@
|
||||
/* Lets old command log rows be pruned by age. Rows written before this have time 0 and are kept. */
|
||||
ALTER TABLE command_log ADD COLUMN time BIGINT NOT NULL DEFAULT 0;
|
||||
CREATE INDEX IF NOT EXISTS command_log_time ON command_log (time);
|
||||
CREATE INDEX IF NOT EXISTS activity_log_time ON activity_log (time);
|
||||
15
migrations/dlu/sqlite/17_server_config.sql
Normal file
15
migrations/dlu/sqlite/17_server_config.sql
Normal file
@@ -0,0 +1,15 @@
|
||||
/* Server settings in the database, editable from the dashboard. See the MySQL migration. */
|
||||
CREATE TABLE IF NOT EXISTS server_config (
|
||||
file TEXT NOT NULL,
|
||||
name TEXT NOT NULL,
|
||||
file_value TEXT NULL,
|
||||
file_source TEXT NOT NULL DEFAULT '',
|
||||
web_value TEXT NULL,
|
||||
web_wins INTEGER NOT NULL DEFAULT 0,
|
||||
secret INTEGER NOT NULL DEFAULT 0,
|
||||
description TEXT NULL,
|
||||
seen_at BIGINT NOT NULL DEFAULT 0,
|
||||
updated_at BIGINT NOT NULL DEFAULT 0,
|
||||
updated_by TEXT NOT NULL DEFAULT '',
|
||||
PRIMARY KEY (file, name)
|
||||
);
|
||||
23
migrations/dlu/sqlite/18_scheduled_tasks.sql
Normal file
23
migrations/dlu/sqlite/18_scheduled_tasks.sql
Normal file
@@ -0,0 +1,23 @@
|
||||
/* Periodic dashboard tasks and their run history. See the MySQL migration. */
|
||||
CREATE TABLE IF NOT EXISTS scheduled_tasks (
|
||||
name TEXT NOT NULL PRIMARY KEY,
|
||||
schedule TEXT NULL,
|
||||
enabled INTEGER NOT NULL DEFAULT 1,
|
||||
last_scheduled_at BIGINT NOT NULL DEFAULT 0,
|
||||
updated_at BIGINT NOT NULL DEFAULT 0,
|
||||
updated_by TEXT NOT NULL DEFAULT ''
|
||||
);
|
||||
|
||||
CREATE TABLE IF NOT EXISTS scheduled_task_runs (
|
||||
id INTEGER PRIMARY KEY AUTOINCREMENT,
|
||||
task TEXT NOT NULL,
|
||||
task_trigger TEXT NOT NULL,
|
||||
actor TEXT NOT NULL DEFAULT '',
|
||||
started_at BIGINT NOT NULL,
|
||||
finished_at BIGINT NOT NULL,
|
||||
status INTEGER NOT NULL,
|
||||
summary TEXT NULL,
|
||||
log TEXT NULL
|
||||
);
|
||||
CREATE INDEX IF NOT EXISTS scheduled_task_runs_task ON scheduled_task_runs (task, id);
|
||||
CREATE INDEX IF NOT EXISTS scheduled_task_runs_finished ON scheduled_task_runs (finished_at);
|
||||
13
migrations/dlu/sqlite/19_character_snapshots.sql
Normal file
13
migrations/dlu/sqlite/19_character_snapshots.sql
Normal file
@@ -0,0 +1,13 @@
|
||||
/* Earlier versions of characters' XML. See the MySQL migration. */
|
||||
CREATE TABLE IF NOT EXISTS character_snapshots (
|
||||
id INTEGER PRIMARY KEY AUTOINCREMENT,
|
||||
character_id BIGINT NOT NULL,
|
||||
taken_at BIGINT NOT NULL,
|
||||
reason TEXT NOT NULL DEFAULT '',
|
||||
actor TEXT NOT NULL DEFAULT '',
|
||||
size INTEGER NOT NULL DEFAULT 0,
|
||||
hash TEXT NOT NULL DEFAULT '',
|
||||
xml BLOB NOT NULL
|
||||
);
|
||||
CREATE INDEX IF NOT EXISTS character_snapshots_character ON character_snapshots (character_id, id);
|
||||
CREATE INDEX IF NOT EXISTS character_snapshots_taken ON character_snapshots (taken_at);
|
||||
12
migrations/dlu/sqlite/20_account_notes.sql
Normal file
12
migrations/dlu/sqlite/20_account_notes.sql
Normal file
@@ -0,0 +1,12 @@
|
||||
/* Moderation history per account, and temporary bans. See the MySQL migration. */
|
||||
ALTER TABLE accounts ADD COLUMN ban_expires BIGINT NOT NULL DEFAULT 0;
|
||||
ALTER TABLE accounts ADD COLUMN ban_reason TEXT NULL;
|
||||
CREATE TABLE IF NOT EXISTS account_notes (
|
||||
id INTEGER PRIMARY KEY AUTOINCREMENT,
|
||||
account_id INTEGER NOT NULL,
|
||||
kind TEXT NOT NULL,
|
||||
text TEXT NOT NULL,
|
||||
actor TEXT NOT NULL DEFAULT '',
|
||||
created_at BIGINT NOT NULL
|
||||
);
|
||||
CREATE INDEX IF NOT EXISTS account_notes_account ON account_notes (account_id, id);
|
||||
9
migrations/dlu/sqlite/21_server_health.sql
Normal file
9
migrations/dlu/sqlite/21_server_health.sql
Normal file
@@ -0,0 +1,9 @@
|
||||
/* Server health samples. See the MySQL migration. */
|
||||
CREATE TABLE IF NOT EXISTS server_health (
|
||||
time BIGINT NOT NULL PRIMARY KEY,
|
||||
players INTEGER NOT NULL DEFAULT 0,
|
||||
worlds INTEGER NOT NULL DEFAULT 0,
|
||||
auth_online INTEGER NOT NULL DEFAULT 0,
|
||||
chat_online INTEGER NOT NULL DEFAULT 0,
|
||||
memory_kb BIGINT NOT NULL DEFAULT 0
|
||||
);
|
||||
11
migrations/dlu/sqlite/22_moderation_decisions.sql
Normal file
11
migrations/dlu/sqlite/22_moderation_decisions.sql
Normal file
@@ -0,0 +1,11 @@
|
||||
/* Moderators' decisions on name requests and pet names. See the MySQL migration. */
|
||||
CREATE TABLE IF NOT EXISTS moderation_decisions (
|
||||
id INTEGER PRIMARY KEY AUTOINCREMENT,
|
||||
kind TEXT NOT NULL,
|
||||
subject_id BIGINT NOT NULL,
|
||||
subject TEXT NOT NULL DEFAULT '',
|
||||
approved INTEGER NOT NULL DEFAULT 0,
|
||||
reason TEXT NOT NULL DEFAULT '',
|
||||
decided_at BIGINT NOT NULL DEFAULT 0
|
||||
);
|
||||
CREATE INDEX IF NOT EXISTS moderation_decisions_subject ON moderation_decisions (kind, subject_id);
|
||||
3
migrations/dlu/sqlite/23_pet_name_owner.sql
Normal file
3
migrations/dlu/sqlite/23_pet_name_owner.sql
Normal file
@@ -0,0 +1,3 @@
|
||||
/* Who owns each named pet. See the MySQL migration. */
|
||||
ALTER TABLE pet_names ADD COLUMN owner_id BIGINT NULL DEFAULT NULL;
|
||||
CREATE INDEX IF NOT EXISTS pet_names_owner ON pet_names (owner_id);
|
||||
4
migrations/dlu/sqlite/24_audit_log_target.sql
Normal file
4
migrations/dlu/sqlite/24_audit_log_target.sql
Normal file
@@ -0,0 +1,4 @@
|
||||
/* What a dashboard action was about. See the MySQL migration. */
|
||||
ALTER TABLE audit_log ADD COLUMN target_account_id INTEGER NOT NULL DEFAULT 0;
|
||||
ALTER TABLE audit_log ADD COLUMN target_character_id BIGINT NOT NULL DEFAULT 0;
|
||||
CREATE INDEX IF NOT EXISTS audit_log_target_account ON audit_log (target_account_id);
|
||||
19
migrations/dlu/sqlite/25_chat_log.sql
Normal file
19
migrations/dlu/sqlite/25_chat_log.sql
Normal file
@@ -0,0 +1,19 @@
|
||||
/* Chat, for moderation and chat bridges. See the MySQL migration. */
|
||||
CREATE TABLE IF NOT EXISTS chat_log (
|
||||
id INTEGER PRIMARY KEY AUTOINCREMENT,
|
||||
time BIGINT NOT NULL,
|
||||
channel TEXT NOT NULL,
|
||||
sender_id BIGINT NOT NULL DEFAULT 0,
|
||||
sender_name TEXT NOT NULL DEFAULT '',
|
||||
account_id INTEGER NOT NULL DEFAULT 0,
|
||||
recipient_id BIGINT NOT NULL DEFAULT 0,
|
||||
recipient_name TEXT NOT NULL DEFAULT '',
|
||||
zone_id INTEGER NOT NULL DEFAULT 0,
|
||||
instance_id INTEGER NOT NULL DEFAULT 0,
|
||||
clone_id INTEGER NOT NULL DEFAULT 0,
|
||||
message TEXT NOT NULL,
|
||||
blocked INTEGER NOT NULL DEFAULT 0
|
||||
);
|
||||
CREATE INDEX IF NOT EXISTS chat_log_time ON chat_log (time);
|
||||
CREATE INDEX IF NOT EXISTS chat_log_sender ON chat_log (sender_id);
|
||||
CREATE INDEX IF NOT EXISTS chat_log_account ON chat_log (account_id);
|
||||
5
migrations/dlu/sqlite/26_dashboard_preferences.sql
Normal file
5
migrations/dlu/sqlite/26_dashboard_preferences.sql
Normal file
@@ -0,0 +1,5 @@
|
||||
/* Each account's dashboard view choices. See the MySQL migration. */
|
||||
CREATE TABLE IF NOT EXISTS dashboard_preferences (
|
||||
account_id INTEGER NOT NULL PRIMARY KEY,
|
||||
prefs TEXT NOT NULL
|
||||
);
|
||||
16
migrations/dlu/sqlite/27_account_strikes.sql
Normal file
16
migrations/dlu/sqlite/27_account_strikes.sql
Normal file
@@ -0,0 +1,16 @@
|
||||
/* Strikes against accounts. See the MySQL migration. */
|
||||
CREATE TABLE IF NOT EXISTS account_strikes (
|
||||
id INTEGER PRIMARY KEY AUTOINCREMENT,
|
||||
account_id INTEGER NOT NULL,
|
||||
character_id BIGINT NOT NULL DEFAULT 0,
|
||||
source TEXT NOT NULL,
|
||||
subject TEXT NOT NULL DEFAULT '',
|
||||
reason TEXT NOT NULL DEFAULT '',
|
||||
given_by_id INTEGER NOT NULL DEFAULT 0,
|
||||
given_by TEXT NOT NULL DEFAULT '',
|
||||
created_at BIGINT NOT NULL,
|
||||
revoked_at BIGINT NOT NULL DEFAULT 0,
|
||||
revoked_by TEXT NOT NULL DEFAULT '',
|
||||
revoke_reason TEXT NOT NULL DEFAULT ''
|
||||
);
|
||||
CREATE INDEX IF NOT EXISTS account_strikes_account ON account_strikes (account_id);
|
||||
9
migrations/dlu/sqlite/28_player_stats_daily.sql
Normal file
9
migrations/dlu/sqlite/28_player_stats_daily.sql
Normal file
@@ -0,0 +1,9 @@
|
||||
/* Daily totals of player statistics. See the MySQL migration. */
|
||||
CREATE TABLE IF NOT EXISTS player_stats_daily (
|
||||
day INTEGER NOT NULL,
|
||||
zone INTEGER NOT NULL,
|
||||
stat INTEGER NOT NULL,
|
||||
gm INTEGER NOT NULL DEFAULT 0,
|
||||
amount BIGINT NOT NULL DEFAULT 0,
|
||||
PRIMARY KEY (day, zone, stat, gm)
|
||||
);
|
||||
13
migrations/dlu/sqlite/29_slash_commands.sql
Normal file
13
migrations/dlu/sqlite/29_slash_commands.sql
Normal file
@@ -0,0 +1,13 @@
|
||||
/* The in-game slash commands as the world servers registered them. See the MySQL migration. */
|
||||
CREATE TABLE IF NOT EXISTS slash_commands (
|
||||
name TEXT NOT NULL PRIMARY KEY,
|
||||
aliases TEXT NOT NULL DEFAULT '',
|
||||
help TEXT NOT NULL DEFAULT '',
|
||||
info TEXT NOT NULL DEFAULT '',
|
||||
default_level INTEGER NOT NULL,
|
||||
min_level INTEGER NOT NULL DEFAULT 0,
|
||||
fixed INTEGER NOT NULL DEFAULT 0,
|
||||
client_handled INTEGER NOT NULL DEFAULT 0,
|
||||
note TEXT NOT NULL DEFAULT '',
|
||||
dashboard_permission TEXT NOT NULL DEFAULT ''
|
||||
);
|
||||
33
migrations/dlu/sqlite/30_moderation_tools.sql
Normal file
33
migrations/dlu/sqlite/30_moderation_tools.sql
Normal file
@@ -0,0 +1,33 @@
|
||||
/* Strike thresholds, player reports and chat filter words. See the MySQL migration. */
|
||||
ALTER TABLE account_strikes ADD COLUMN step TEXT NOT NULL DEFAULT '';
|
||||
ALTER TABLE account_strikes ADD COLUMN step_count INTEGER NOT NULL DEFAULT 0;
|
||||
|
||||
CREATE TABLE IF NOT EXISTS player_reports (
|
||||
id INTEGER PRIMARY KEY AUTOINCREMENT,
|
||||
created_at BIGINT NOT NULL,
|
||||
kind TEXT NOT NULL,
|
||||
reporter_id BIGINT NOT NULL DEFAULT 0,
|
||||
reporter_account_id INTEGER NOT NULL DEFAULT 0,
|
||||
object_id BIGINT NOT NULL DEFAULT 0,
|
||||
object_lot INTEGER NOT NULL DEFAULT 0,
|
||||
target_character_id BIGINT NOT NULL DEFAULT 0,
|
||||
target_account_id INTEGER NOT NULL DEFAULT 0,
|
||||
property_id BIGINT NOT NULL DEFAULT 0,
|
||||
zone_id INTEGER NOT NULL DEFAULT 0,
|
||||
instance_id INTEGER NOT NULL DEFAULT 0,
|
||||
clone_id INTEGER NOT NULL DEFAULT 0,
|
||||
body TEXT NOT NULL DEFAULT '',
|
||||
status INTEGER NOT NULL DEFAULT 0,
|
||||
handled_by TEXT NOT NULL DEFAULT '',
|
||||
handled_at BIGINT NOT NULL DEFAULT 0,
|
||||
resolution TEXT NOT NULL DEFAULT ''
|
||||
);
|
||||
CREATE INDEX IF NOT EXISTS player_reports_status ON player_reports (status, id);
|
||||
CREATE INDEX IF NOT EXISTS player_reports_target ON player_reports (target_account_id);
|
||||
|
||||
CREATE TABLE IF NOT EXISTS chat_filter_words (
|
||||
word TEXT NOT NULL PRIMARY KEY,
|
||||
allowed INTEGER NOT NULL,
|
||||
added_by TEXT NOT NULL DEFAULT '',
|
||||
added_at BIGINT NOT NULL
|
||||
);
|
||||
10
migrations/dlu/sqlite/31_login_addresses.sql
Normal file
10
migrations/dlu/sqlite/31_login_addresses.sql
Normal file
@@ -0,0 +1,10 @@
|
||||
/* Where accounts log in to the game from. See the MySQL migration. */
|
||||
CREATE TABLE IF NOT EXISTS account_login_addresses (
|
||||
account_id INTEGER NOT NULL,
|
||||
address TEXT NOT NULL,
|
||||
first_seen BIGINT NOT NULL,
|
||||
last_seen BIGINT NOT NULL,
|
||||
logins INTEGER NOT NULL DEFAULT 1,
|
||||
PRIMARY KEY (account_id, address)
|
||||
);
|
||||
CREATE INDEX IF NOT EXISTS account_login_addresses_address ON account_login_addresses (address);
|
||||
50
migrations/dlu/sqlite/34_server_operations.sql
Normal file
50
migrations/dlu/sqlite/34_server_operations.sql
Normal file
@@ -0,0 +1,50 @@
|
||||
/* Scheduled announcements, events, zone limits and per-instance player samples. See the MySQL migration. */
|
||||
CREATE TABLE IF NOT EXISTS scheduled_announcements (
|
||||
id INTEGER PRIMARY KEY AUTOINCREMENT,
|
||||
title TEXT NOT NULL DEFAULT '',
|
||||
message TEXT NOT NULL,
|
||||
zones TEXT NOT NULL DEFAULT '',
|
||||
schedule TEXT NOT NULL,
|
||||
starts_at BIGINT NOT NULL DEFAULT 0,
|
||||
ends_at BIGINT NOT NULL DEFAULT 0,
|
||||
enabled INTEGER NOT NULL DEFAULT 1,
|
||||
last_sent_at BIGINT NOT NULL DEFAULT 0,
|
||||
sent_count INTEGER NOT NULL DEFAULT 0,
|
||||
created_at BIGINT NOT NULL DEFAULT 0,
|
||||
created_by TEXT NOT NULL DEFAULT '',
|
||||
updated_at BIGINT NOT NULL DEFAULT 0,
|
||||
updated_by TEXT NOT NULL DEFAULT ''
|
||||
);
|
||||
CREATE TABLE IF NOT EXISTS scheduled_events (
|
||||
id INTEGER PRIMARY KEY AUTOINCREMENT,
|
||||
feature TEXT NOT NULL,
|
||||
note TEXT NOT NULL DEFAULT '',
|
||||
starts_at BIGINT NOT NULL,
|
||||
ends_at BIGINT NOT NULL,
|
||||
state INTEGER NOT NULL DEFAULT 0,
|
||||
slot INTEGER NOT NULL DEFAULT 0,
|
||||
previous_value TEXT NULL DEFAULT NULL,
|
||||
previous_web_wins INTEGER NOT NULL DEFAULT 0,
|
||||
status TEXT NOT NULL DEFAULT '',
|
||||
created_at BIGINT NOT NULL DEFAULT 0,
|
||||
created_by TEXT NOT NULL DEFAULT '',
|
||||
updated_at BIGINT NOT NULL DEFAULT 0,
|
||||
updated_by TEXT NOT NULL DEFAULT ''
|
||||
);
|
||||
CREATE TABLE IF NOT EXISTS zone_limits (
|
||||
zone_id INTEGER NOT NULL PRIMARY KEY,
|
||||
soft_cap INTEGER NULL DEFAULT NULL,
|
||||
hard_cap INTEGER NULL DEFAULT NULL,
|
||||
spare_instances INTEGER NOT NULL DEFAULT 0,
|
||||
updated_at BIGINT NOT NULL DEFAULT 0,
|
||||
updated_by TEXT NOT NULL DEFAULT ''
|
||||
);
|
||||
CREATE TABLE IF NOT EXISTS server_health_instances (
|
||||
time BIGINT NOT NULL,
|
||||
zone_id INTEGER NOT NULL,
|
||||
instance_id INTEGER NOT NULL,
|
||||
clone_id INTEGER NOT NULL DEFAULT 0,
|
||||
players INTEGER NOT NULL DEFAULT 0,
|
||||
PRIMARY KEY (time, zone_id, instance_id)
|
||||
);
|
||||
CREATE INDEX IF NOT EXISTS server_health_instances_zone ON server_health_instances (zone_id, time);
|
||||
18
migrations/dlu/sqlite/35_setting_history.sql
Normal file
18
migrations/dlu/sqlite/35_setting_history.sql
Normal file
@@ -0,0 +1,18 @@
|
||||
/* Every change of a setting's web value. See the MySQL migration. */
|
||||
CREATE TABLE IF NOT EXISTS server_config_history (
|
||||
id INTEGER PRIMARY KEY AUTOINCREMENT,
|
||||
file TEXT NOT NULL,
|
||||
name TEXT NOT NULL,
|
||||
old_value TEXT NULL DEFAULT NULL,
|
||||
old_web_wins INTEGER NOT NULL DEFAULT 0,
|
||||
new_value TEXT NULL DEFAULT NULL,
|
||||
new_web_wins INTEGER NOT NULL DEFAULT 0,
|
||||
file_value TEXT NULL DEFAULT NULL,
|
||||
secret INTEGER NOT NULL DEFAULT 0,
|
||||
removed INTEGER NOT NULL DEFAULT 0,
|
||||
revert_of BIGINT NOT NULL DEFAULT 0,
|
||||
changed_at BIGINT NOT NULL,
|
||||
account_id INTEGER NOT NULL DEFAULT 0,
|
||||
changed_by TEXT NOT NULL DEFAULT ''
|
||||
);
|
||||
CREATE INDEX IF NOT EXISTS server_config_history_setting ON server_config_history (file, name, id);
|
||||
13
migrations/dlu/sqlite/40_lookup_indexes.sql
Normal file
13
migrations/dlu/sqlite/40_lookup_indexes.sql
Normal file
@@ -0,0 +1,13 @@
|
||||
/* Indexes for lookups by owner/parent that otherwise scan the whole table. See the MySQL migration. */
|
||||
CREATE INDEX IF NOT EXISTS properties_contents_property ON properties_contents (property_id);
|
||||
CREATE INDEX IF NOT EXISTS properties_contents_ugc ON properties_contents (ugc_id);
|
||||
CREATE INDEX IF NOT EXISTS properties_owner ON properties (owner_id);
|
||||
CREATE INDEX IF NOT EXISTS charinfo_account ON charinfo (account_id);
|
||||
CREATE INDEX IF NOT EXISTS accounts_play_key ON accounts (play_key_id);
|
||||
CREATE INDEX IF NOT EXISTS friends_friend ON friends (friend_id);
|
||||
CREATE INDEX IF NOT EXISTS mail_receiver ON mail (receiver_id);
|
||||
CREATE INDEX IF NOT EXISTS leaderboard_game ON leaderboard (game_id, character_id);
|
||||
CREATE INDEX IF NOT EXISTS bug_reports_reporter ON bug_reports (reporter_id);
|
||||
CREATE INDEX IF NOT EXISTS economy_flags_character ON economy_flags (character_id, id);
|
||||
CREATE INDEX IF NOT EXISTS player_cheat_detections_account ON player_cheat_detections (account_id);
|
||||
CREATE INDEX IF NOT EXISTS chat_log_recipient ON chat_log (recipient_id);
|
||||
14
migrations/dlu/sqlite/43_player_positions.sql
Normal file
14
migrations/dlu/sqlite/43_player_positions.sql
Normal file
@@ -0,0 +1,14 @@
|
||||
/* Player position samples for replays. See the MySQL migration. */
|
||||
CREATE TABLE IF NOT EXISTS player_positions (
|
||||
character_id BIGINT NOT NULL,
|
||||
time BIGINT NOT NULL,
|
||||
zone_id INTEGER NOT NULL,
|
||||
instance_id INTEGER NOT NULL,
|
||||
clone_id INTEGER NOT NULL DEFAULT 0,
|
||||
x REAL NOT NULL,
|
||||
y REAL NOT NULL,
|
||||
z REAL NOT NULL,
|
||||
PRIMARY KEY (character_id, time)
|
||||
);
|
||||
CREATE INDEX IF NOT EXISTS player_positions_zone_time ON player_positions (zone_id, time);
|
||||
CREATE INDEX IF NOT EXISTS player_positions_time ON player_positions (time);
|
||||
19
migrations/dlu/sqlite/44_ai_suggestions.sql
Normal file
19
migrations/dlu/sqlite/44_ai_suggestions.sql
Normal file
@@ -0,0 +1,19 @@
|
||||
/* AI moderator helper suggestions (staff only). See the MySQL migration. */
|
||||
CREATE TABLE IF NOT EXISTS ai_suggestions (
|
||||
id INTEGER NOT NULL PRIMARY KEY AUTOINCREMENT,
|
||||
kind TEXT NOT NULL,
|
||||
item_id BIGINT NOT NULL,
|
||||
fingerprint TEXT NOT NULL,
|
||||
requested_by_id INTEGER NOT NULL DEFAULT 0,
|
||||
requested_by TEXT NOT NULL DEFAULT '',
|
||||
created_at BIGINT NOT NULL,
|
||||
model TEXT NOT NULL DEFAULT '',
|
||||
input_tokens INTEGER NOT NULL DEFAULT 0,
|
||||
output_tokens INTEGER NOT NULL DEFAULT 0,
|
||||
status INTEGER NOT NULL DEFAULT 0,
|
||||
suggestion TEXT NULL,
|
||||
error TEXT NULL,
|
||||
context TEXT NULL
|
||||
);
|
||||
CREATE INDEX IF NOT EXISTS ai_suggestions_item ON ai_suggestions (kind, item_id, id);
|
||||
CREATE INDEX IF NOT EXISTS ai_suggestions_time ON ai_suggestions (created_at);
|
||||
33
migrations/dlu/sqlite/46_live_events.sql
Normal file
33
migrations/dlu/sqlite/46_live_events.sql
Normal file
@@ -0,0 +1,33 @@
|
||||
/* Live events started from the dashboard. See the MySQL migration. */
|
||||
CREATE TABLE IF NOT EXISTS live_events (
|
||||
id INTEGER PRIMARY KEY AUTOINCREMENT,
|
||||
type TEXT NOT NULL,
|
||||
title TEXT NOT NULL DEFAULT '',
|
||||
message TEXT NOT NULL DEFAULT '',
|
||||
zones TEXT NOT NULL DEFAULT '',
|
||||
instance_id INTEGER NOT NULL DEFAULT -1,
|
||||
config TEXT NOT NULL DEFAULT '{}',
|
||||
starts_at BIGINT NOT NULL,
|
||||
ends_at BIGINT NOT NULL,
|
||||
state INTEGER NOT NULL DEFAULT 0,
|
||||
ended_at BIGINT NOT NULL DEFAULT 0,
|
||||
end_reason TEXT NOT NULL DEFAULT '',
|
||||
created_by TEXT NOT NULL DEFAULT '',
|
||||
ended_by TEXT NOT NULL DEFAULT ''
|
||||
);
|
||||
CREATE INDEX IF NOT EXISTS live_events_state ON live_events (state);
|
||||
CREATE TABLE IF NOT EXISTS live_event_instances (
|
||||
event_id INTEGER NOT NULL,
|
||||
zone_id INTEGER NOT NULL,
|
||||
instance_id INTEGER NOT NULL,
|
||||
status TEXT NOT NULL DEFAULT '{}',
|
||||
updated_at BIGINT NOT NULL DEFAULT 0,
|
||||
PRIMARY KEY (event_id, zone_id, instance_id)
|
||||
);
|
||||
CREATE TABLE IF NOT EXISTS live_event_scores (
|
||||
event_id INTEGER NOT NULL,
|
||||
character_id BIGINT NOT NULL,
|
||||
amount BIGINT NOT NULL DEFAULT 0,
|
||||
updated_at BIGINT NOT NULL DEFAULT 0,
|
||||
PRIMARY KEY (event_id, character_id)
|
||||
);
|
||||
46
migrations/dlu/sqlite/47_challenges.sql
Normal file
46
migrations/dlu/sqlite/47_challenges.sql
Normal file
@@ -0,0 +1,46 @@
|
||||
/* Server-wide community challenges. See the MySQL migration. */
|
||||
CREATE TABLE IF NOT EXISTS challenges (
|
||||
id INTEGER PRIMARY KEY AUTOINCREMENT,
|
||||
title TEXT NOT NULL,
|
||||
description TEXT NOT NULL DEFAULT '',
|
||||
metric_kind INTEGER NOT NULL DEFAULT 0,
|
||||
metric INTEGER NOT NULL,
|
||||
lot INTEGER NOT NULL DEFAULT 0,
|
||||
zones TEXT NOT NULL DEFAULT '',
|
||||
target BIGINT NOT NULL,
|
||||
starts_at BIGINT NOT NULL,
|
||||
ends_at BIGINT NOT NULL,
|
||||
include_staff INTEGER NOT NULL DEFAULT 0,
|
||||
is_public INTEGER NOT NULL DEFAULT 1,
|
||||
reward_coins BIGINT NOT NULL DEFAULT 0,
|
||||
reward_items TEXT NOT NULL DEFAULT '[]',
|
||||
reward_min BIGINT NOT NULL DEFAULT 1,
|
||||
state INTEGER NOT NULL DEFAULT 0,
|
||||
milestone INTEGER NOT NULL DEFAULT 0,
|
||||
completed_at BIGINT NOT NULL DEFAULT 0,
|
||||
rewarded_at BIGINT NOT NULL DEFAULT 0,
|
||||
rewarded_count INTEGER NOT NULL DEFAULT 0,
|
||||
created_at BIGINT NOT NULL DEFAULT 0,
|
||||
created_by TEXT NOT NULL DEFAULT '',
|
||||
updated_at BIGINT NOT NULL DEFAULT 0,
|
||||
updated_by TEXT NOT NULL DEFAULT ''
|
||||
);
|
||||
CREATE INDEX IF NOT EXISTS challenges_state ON challenges (state);
|
||||
CREATE TABLE IF NOT EXISTS challenge_contributions (
|
||||
challenge_id INTEGER NOT NULL,
|
||||
character_id BIGINT NOT NULL,
|
||||
amount BIGINT NOT NULL DEFAULT 0,
|
||||
updated_at BIGINT NOT NULL DEFAULT 0,
|
||||
PRIMARY KEY (challenge_id, character_id)
|
||||
);
|
||||
CREATE INDEX IF NOT EXISTS challenge_contributions_character ON challenge_contributions (character_id);
|
||||
CREATE TABLE IF NOT EXISTS challenge_rewards (
|
||||
challenge_id INTEGER NOT NULL,
|
||||
character_id BIGINT NOT NULL,
|
||||
amount BIGINT NOT NULL DEFAULT 0,
|
||||
coins BIGINT NOT NULL DEFAULT 0,
|
||||
rewarded_at BIGINT NOT NULL DEFAULT 0,
|
||||
claimed_at BIGINT NOT NULL DEFAULT 0,
|
||||
PRIMARY KEY (challenge_id, character_id)
|
||||
);
|
||||
CREATE INDEX IF NOT EXISTS challenge_rewards_character ON challenge_rewards (character_id, claimed_at);
|
||||
2
migrations/dlu/sqlite/48_transfer_merged.sql
Normal file
2
migrations/dlu/sqlite/48_transfer_merged.sql
Normal file
@@ -0,0 +1,2 @@
|
||||
/* economy_transfers.merged: see the MySQL migration. */
|
||||
ALTER TABLE economy_transfers ADD COLUMN merged INTEGER DEFAULT NULL;
|
||||
3
migrations/dlu/sqlite/49_slash_command_targets.sql
Normal file
3
migrations/dlu/sqlite/49_slash_command_targets.sql
Normal file
@@ -0,0 +1,3 @@
|
||||
/* slash_commands.target_rule and follows_permission: see the MySQL migration. */
|
||||
ALTER TABLE slash_commands ADD COLUMN target_rule TEXT NOT NULL DEFAULT '';
|
||||
ALTER TABLE slash_commands ADD COLUMN follows_permission INTEGER NOT NULL DEFAULT 0;
|
||||
2
migrations/dlu/sqlite/50_challenge_end_announced.sql
Normal file
2
migrations/dlu/sqlite/50_challenge_end_announced.sql
Normal file
@@ -0,0 +1,2 @@
|
||||
/* challenges.end_announced_at: see the MySQL migration. */
|
||||
ALTER TABLE challenges ADD COLUMN end_announced_at BIGINT NOT NULL DEFAULT 0;
|
||||
8
migrations/dlu/sqlite/51_featured_properties.sql
Normal file
8
migrations/dlu/sqlite/51_featured_properties.sql
Normal file
@@ -0,0 +1,8 @@
|
||||
/* featured_properties: see the MySQL migration. */
|
||||
CREATE TABLE IF NOT EXISTS featured_properties (
|
||||
template_id INTEGER NOT NULL PRIMARY KEY,
|
||||
mode INTEGER NOT NULL DEFAULT 0,
|
||||
property_id BIGINT NOT NULL DEFAULT 0,
|
||||
updated_at BIGINT NOT NULL DEFAULT 0,
|
||||
updated_by TEXT NOT NULL DEFAULT ''
|
||||
);
|
||||
33
migrations/dlu/sqlite/52_economy_property_clone.sql
Normal file
33
migrations/dlu/sqlite/52_economy_property_clone.sql
Normal file
@@ -0,0 +1,33 @@
|
||||
/* map_events_daily and player_stats_daily get clone_id in their keys: see the MySQL migration. SQLite can't change a
|
||||
primary key, so the tables are rebuilt. */
|
||||
BEGIN TRANSACTION;
|
||||
CREATE TABLE map_events_daily_2 (
|
||||
day INTEGER NOT NULL,
|
||||
zone INTEGER NOT NULL,
|
||||
kind INTEGER NOT NULL,
|
||||
lot INTEGER NOT NULL,
|
||||
cell_x INTEGER NOT NULL,
|
||||
cell_z INTEGER NOT NULL,
|
||||
events BIGINT NOT NULL DEFAULT 0,
|
||||
quantity BIGINT NOT NULL DEFAULT 0,
|
||||
clone_id INTEGER NOT NULL DEFAULT 0,
|
||||
PRIMARY KEY (zone, kind, day, clone_id, lot, cell_x, cell_z)
|
||||
);
|
||||
INSERT INTO map_events_daily_2 (day, zone, kind, lot, cell_x, cell_z, events, quantity)
|
||||
SELECT day, zone, kind, lot, cell_x, cell_z, events, quantity FROM map_events_daily;
|
||||
DROP TABLE map_events_daily;
|
||||
ALTER TABLE map_events_daily_2 RENAME TO map_events_daily;
|
||||
CREATE TABLE player_stats_daily_2 (
|
||||
day INTEGER NOT NULL,
|
||||
zone INTEGER NOT NULL,
|
||||
stat INTEGER NOT NULL,
|
||||
gm INTEGER NOT NULL DEFAULT 0,
|
||||
amount BIGINT NOT NULL DEFAULT 0,
|
||||
clone_id INTEGER NOT NULL DEFAULT 0,
|
||||
PRIMARY KEY (day, zone, clone_id, stat, gm)
|
||||
);
|
||||
INSERT INTO player_stats_daily_2 (day, zone, stat, gm, amount)
|
||||
SELECT day, zone, stat, gm, amount FROM player_stats_daily;
|
||||
DROP TABLE player_stats_daily;
|
||||
ALTER TABLE player_stats_daily_2 RENAME TO player_stats_daily;
|
||||
COMMIT;
|
||||
16
migrations/dlu/sqlite/53_vanity_events.sql
Normal file
16
migrations/dlu/sqlite/53_vanity_events.sql
Normal file
@@ -0,0 +1,16 @@
|
||||
/* vanity_events: see the MySQL migration. */
|
||||
CREATE TABLE IF NOT EXISTS vanity_events (
|
||||
id INTEGER PRIMARY KEY AUTOINCREMENT,
|
||||
name TEXT NOT NULL,
|
||||
note TEXT NOT NULL DEFAULT '',
|
||||
file TEXT NOT NULL DEFAULT '',
|
||||
removals TEXT NOT NULL DEFAULT '',
|
||||
schedule TEXT NOT NULL DEFAULT '',
|
||||
priority INTEGER NOT NULL DEFAULT 0,
|
||||
mode INTEGER NOT NULL DEFAULT 0,
|
||||
applied INTEGER NOT NULL DEFAULT 0,
|
||||
created_at BIGINT NOT NULL DEFAULT 0,
|
||||
created_by TEXT NOT NULL DEFAULT '',
|
||||
updated_at BIGINT NOT NULL DEFAULT 0,
|
||||
updated_by TEXT NOT NULL DEFAULT ''
|
||||
);
|
||||
@@ -0,0 +1,8 @@
|
||||
/* featured_properties.zone_id and featured_properties_settings: see the MySQL migration. */
|
||||
ALTER TABLE featured_properties ADD COLUMN zone_id INTEGER NOT NULL DEFAULT 0;
|
||||
CREATE TABLE IF NOT EXISTS featured_properties_settings (
|
||||
id INTEGER NOT NULL PRIMARY KEY,
|
||||
full_auto INTEGER NOT NULL DEFAULT 0,
|
||||
updated_at BIGINT NOT NULL DEFAULT 0,
|
||||
updated_by TEXT NOT NULL DEFAULT ''
|
||||
);
|
||||
2
migrations/dlu/sqlite/55_vanity_event_file_switches.sql
Normal file
2
migrations/dlu/sqlite/55_vanity_event_file_switches.sql
Normal file
@@ -0,0 +1,2 @@
|
||||
/* vanity_events.file_switches: see the MySQL migration. */
|
||||
ALTER TABLE vanity_events ADD COLUMN file_switches TEXT NOT NULL DEFAULT '';
|
||||
45
migrations/dlu/sqlite/56_message_capture_sessions.sql
Normal file
45
migrations/dlu/sqlite/56_message_capture_sessions.sql
Normal file
@@ -0,0 +1,45 @@
|
||||
/* message_capture_sessions and message_capture_entries: see the MySQL migration. */
|
||||
CREATE TABLE IF NOT EXISTS message_capture_sessions (
|
||||
id INTEGER PRIMARY KEY AUTOINCREMENT,
|
||||
character_id BIGINT NOT NULL,
|
||||
character_name TEXT NOT NULL DEFAULT '',
|
||||
account_id INTEGER NOT NULL DEFAULT 0,
|
||||
account_name TEXT NOT NULL DEFAULT '',
|
||||
started_by_id INTEGER NOT NULL DEFAULT 0,
|
||||
started_by TEXT NOT NULL DEFAULT '',
|
||||
started_at BIGINT NOT NULL DEFAULT 0,
|
||||
ends_at BIGINT NOT NULL DEFAULT 0,
|
||||
ended_at BIGINT NOT NULL DEFAULT 0,
|
||||
end_reason TEXT NOT NULL DEFAULT '',
|
||||
to_server INTEGER NOT NULL DEFAULT 1,
|
||||
to_client INTEGER NOT NULL DEFAULT 1,
|
||||
only_messages TEXT NOT NULL DEFAULT '',
|
||||
skip_messages TEXT NOT NULL DEFAULT '',
|
||||
zone_id INTEGER NOT NULL DEFAULT 0,
|
||||
instance_id INTEGER NOT NULL DEFAULT 0,
|
||||
clone_id INTEGER NOT NULL DEFAULT 0,
|
||||
zones TEXT NOT NULL DEFAULT '',
|
||||
message_count BIGINT NOT NULL DEFAULT 0,
|
||||
byte_count BIGINT NOT NULL DEFAULT 0,
|
||||
dropped BIGINT NOT NULL DEFAULT 0
|
||||
);
|
||||
CREATE INDEX IF NOT EXISTS message_capture_sessions_character ON message_capture_sessions (character_id);
|
||||
CREATE INDEX IF NOT EXISTS message_capture_sessions_account ON message_capture_sessions (account_id);
|
||||
CREATE INDEX IF NOT EXISTS message_capture_sessions_started ON message_capture_sessions (started_at);
|
||||
|
||||
CREATE TABLE IF NOT EXISTS message_capture_entries (
|
||||
session_id BIGINT NOT NULL,
|
||||
seq INTEGER NOT NULL,
|
||||
time_ms BIGINT NOT NULL,
|
||||
direction INTEGER NOT NULL,
|
||||
message_id INTEGER NOT NULL,
|
||||
object_id BIGINT NOT NULL,
|
||||
bits INTEGER NOT NULL,
|
||||
dropped_before INTEGER NOT NULL DEFAULT 0,
|
||||
zone_id INTEGER NOT NULL DEFAULT 0,
|
||||
instance_id INTEGER NOT NULL DEFAULT 0,
|
||||
clone_id INTEGER NOT NULL DEFAULT 0,
|
||||
payload BLOB NOT NULL,
|
||||
decoded TEXT NOT NULL DEFAULT '',
|
||||
PRIMARY KEY (session_id, seq)
|
||||
);
|
||||
18
migrations/dlu/sqlite/57_scheduled_event_parts.sql
Normal file
18
migrations/dlu/sqlite/57_scheduled_event_parts.sql
Normal file
@@ -0,0 +1,18 @@
|
||||
/* scheduled_events name, mode, schedule, priority and parts, and the calendar and vanity events moved into them: see
|
||||
the MySQL migration. */
|
||||
ALTER TABLE scheduled_events ADD COLUMN name TEXT NOT NULL DEFAULT '';
|
||||
ALTER TABLE scheduled_events ADD COLUMN mode INTEGER NOT NULL DEFAULT 1;
|
||||
ALTER TABLE scheduled_events ADD COLUMN schedule TEXT NOT NULL DEFAULT '';
|
||||
ALTER TABLE scheduled_events ADD COLUMN priority INTEGER NOT NULL DEFAULT 0;
|
||||
ALTER TABLE scheduled_events ADD COLUMN parts TEXT NOT NULL DEFAULT '';
|
||||
UPDATE scheduled_events SET name = feature, mode = CASE WHEN state = 3 THEN 0 ELSE 1 END,
|
||||
parts = json_array(json_object('kind', 'feature', 'config', json_object('feature', feature), 'applied', json(CASE WHEN state = 1 THEN 'true' ELSE 'false' END),
|
||||
'state', json_object('slot', slot, 'previousValue', previous_value, 'previousWebWins', json(CASE WHEN previous_web_wins <> 0 THEN 'true' ELSE 'false' END)), 'status', status))
|
||||
WHERE parts = '' AND feature <> '';
|
||||
INSERT INTO scheduled_events (feature, name, note, mode, schedule, starts_at, ends_at, priority, parts, state, status, created_at, created_by, updated_at, updated_by)
|
||||
SELECT '', name, note, mode, schedule, 0, 0, priority,
|
||||
json_array(json_object('kind', 'vanity', 'config', json_object('file', file, 'removals', removals,
|
||||
'fileSwitches', CASE WHEN file_switches = '' THEN json_object() ELSE json(file_switches) END),
|
||||
'applied', json(CASE WHEN applied <> 0 THEN 'true' ELSE 'false' END), 'state', json_object(), 'status', '')),
|
||||
CASE WHEN applied <> 0 THEN 1 ELSE 0 END, '', created_at, created_by, updated_at, updated_by
|
||||
FROM vanity_events;
|
||||
Reference in New Issue
Block a user