Files
Module-Rust/server/db/purge.sql
wtclaude 1b70cef5be feat(rust): chat titles, BetterChat group styles, the voice and popups (phase 17)
PLAN.md §33, D134-D143. Protocol 12.

- Chat titles (D135-D137): per-server rules (stat, top N, text, colour)
  that rank the current wipe, and a mode (first | all | up to N). Worked
  out once in model/titles and read three ways: pushed whole to the game by
  a new titleSync loop (on change, restart or wipe), and on every
  leaderboard row as `titles`. Admin: PUT /servers/:id/titles.
- Group styles (D138, D139): a site group may carry all twelve BetterChat
  fields (rust_perm_group_chat). They ride perm.sync with `expect` from the
  pushed ledger, which gains a value column; a field changed in game is a
  `chat-field` drift row with the game's value, adopted into the style or
  put back. A withdrawn style is one `chat-group` retirement, never for
  `default`, cleared from the ledger only once BetterChat removed it.
- The voice (D140): one fleet setting naming a styled group; news and
  rust.announce chat lines carry its format and the plugin says them with
  no sender. Admin: GET/PUT /voice.
- Popups (D141, D142): rust.announce gains `delivery` (still version 1,
  from rust.options.delivery); each server gains news_delivery beside the
  news switch; `popup-unavailable` is not retried.
- GET /servers/:id/integrations reads, live, which optional mods a server
  has loaded. README lists BetterChat and PopupNotifications as optional.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01E14m6SuuY6i1vASFeGDBeY
2026-09-25 17:48:22 -05:00

62 lines
2.6 KiB
SQL

-- ── The teardown ──────────────────────────────────────────────────────────
--
-- Destructive, and run ONLY by an explicit admin purge (MODULE_API.md §2.6).
-- Nothing on the boot path executes this file, and uninstalling the module does
-- not either: removing an operator's data is a second decision they make on
-- purpose, offered inside the uninstall flow and confirmed separately.
--
-- It exists because `schema.sql` does. A module that can create tables and
-- cannot drop them leaves an operator with orphaned data and no supported way to
-- remove it, so core refuses to load a module that declares one without the
-- other.
--
-- **Drop in the reverse of creation order**, which this file depends on:
-- `rust_server_state` carries a foreign key into `rust_servers`, so dropping the
-- parent first fails on the constraint — and a purge that fails halfway leaves
-- exactly the orphaned data it exists to remove.
--
-- What does NOT belong here: rows written into core's tables. Core prunes what
-- it knows this module registered, because it is the side that knows which
-- registrant owned what.
-- Phase 17. `rust_perm_group_chat` before `rust_perm_groups`, which it
-- references; the rest of this phase is columns, which go with their tables.
DROP TABLE IF EXISTS rust_perm_group_chat;
DROP TABLE IF EXISTS rust_title_rules;
-- Phase 14.
DROP TABLE IF EXISTS rust_map_overrides;
DROP TABLE IF EXISTS rust_map_images;
-- Phase 13b.
DROP TABLE IF EXISTS rust_perm_run_grants;
-- Phase 7b.
DROP TABLE IF EXISTS rust_clan_boards;
DROP TABLE IF EXISTS rust_clan_members;
DROP TABLE IF EXISTS rust_clans;
DROP TABLE IF EXISTS rust_settings;
DROP TABLE IF EXISTS rust_config_writes;
-- Phase 7. Children before parents: every one of these carries a foreign key
-- into `rust_servers`, `users` or `rust_perm_groups`.
DROP TABLE IF EXISTS rust_perm_catalogue;
DROP TABLE IF EXISTS rust_perm_sync;
DROP TABLE IF EXISTS rust_perm_revocations;
DROP TABLE IF EXISTS rust_perm_drift;
DROP TABLE IF EXISTS rust_perm_pushed;
DROP TABLE IF EXISTS rust_perm_grants;
DROP TABLE IF EXISTS rust_perm_group_members;
DROP TABLE IF EXISTS rust_perm_group_permissions;
DROP TABLE IF EXISTS rust_perm_groups;
DROP TABLE IF EXISTS rust_account_links;
DROP TABLE IF EXISTS rust_ingest_cursor;
DROP TABLE IF EXISTS rust_presence;
DROP TABLE IF EXISTS rust_events;
DROP TABLE IF EXISTS rust_gather_totals;
DROP TABLE IF EXISTS rust_player_wipe_stats;
DROP TABLE IF EXISTS rust_players;
DROP TABLE IF EXISTS rust_wipes;
DROP TABLE IF EXISTS rust_server_state;
DROP TABLE IF EXISTS rust_servers;