mirror of
https://github.com/prosolis/gogobee.git
synced 2026-07-15 08:32:41 +00:00
Adv 2.0 Phase L2 step 5: arena counters → player_meta
Creates the player_meta table (gogobee_legacy_migration.md §2.1) with the three columns L2 needs: arena_wins, arena_losses, invasion_score. Future phases ALTER in their own columns. Naming follows the §2.0 callout — no dnd_ prefix on new tables. Helpers in internal/plugin/player_meta.go: loadPlayerMeta, upsertPlayerMetaArena, backfillPlayerMetaArena (INSERT OR IGNORE, idempotent, logs row count per Phase R1 precedent). Plugin Init runs the backfill once on startup. Dual-write per §11: every char.ArenaWins++/ArenaLosses++ in adventure_arena.go also calls upsertPlayerMetaArena. AdvCharacter columns stay in place — reads will switch back to AdvCharacter trivially if a rollback is needed before L5 teardown. Read swap: handleArenaStats and renderDnDSheet now load player_meta and prefer its values (falling back to AdvCharacter if the row is missing, which only matters during the deploy window before backfill runs). renderArenaPersonalStats's signature changed from (char, stats) to (displayName, wins, losses, stats) so the render is DB-free. Tests: TestPlayerMetaArenaBackfill_Idempotent verifies double-run backfill is a no-op and doesn't clobber post-backfill dual-writes; TestUpsertPlayerMetaArena_RoundTrip covers insert/update/missing-user paths. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -1698,6 +1698,19 @@ CREATE TABLE IF NOT EXISTS dnd_known_recipe (
|
||||
discovered_at DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP,
|
||||
PRIMARY KEY (user_id, recipe_id)
|
||||
);
|
||||
|
||||
-- ── Adv 2.0 Phase L2 step 5 — player_meta ──────────────────────────────────
|
||||
-- Holding pen for non-stat per-user state migrating off adventure_characters
|
||||
-- (gogobee_legacy_migration.md §2.1). Each L-phase ALTER TABLEs in the
|
||||
-- columns it needs; this initial CREATE only covers L2's three arena
|
||||
-- counters. The dual-write rule (§11) applies: writes go to both this
|
||||
-- table and adventure_characters until a phase soaks clean for one week.
|
||||
CREATE TABLE IF NOT EXISTS player_meta (
|
||||
user_id TEXT PRIMARY KEY,
|
||||
arena_wins INTEGER NOT NULL DEFAULT 0,
|
||||
arena_losses INTEGER NOT NULL DEFAULT 0,
|
||||
invasion_score INTEGER NOT NULL DEFAULT 0
|
||||
);
|
||||
`
|
||||
|
||||
// SeedSchedulerDefaults inserts default scheduler jobs if they don't exist.
|
||||
|
||||
Reference in New Issue
Block a user