Adv 2.0 L4a: hospital migrates HospitalVisits + cost formula off AdvCharacter

player_meta.hospital_visits column added with idempotent backfill.
Hospital cost now DnDCharacter.Level x 50k (5x before insurance), falling
back to dndLevelFromCombatLevel when no D&D row exists. Revive paths also
restore DnDCharacter HP to full; char.Alive still dual-writes during soak.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
prosolis
2026-05-09 09:46:56 -07:00
parent cc6fb7dd39
commit 730f16580a
6 changed files with 276 additions and 21 deletions

View File

@@ -190,6 +190,10 @@ func runMigrations(d *sql.DB) error {
// player_meta gets the canonical column; AdvCharacter.display_name
// keeps dual-writing during soak (gogobee_legacy_migration.md §7).
`ALTER TABLE player_meta ADD COLUMN display_name TEXT NOT NULL DEFAULT ''`,
// Adv 2.0 Phase L4a — Hospital migration off AdvCharacter.
// HospitalVisits moves to player_meta; AdvCharacter.hospital_visits
// keeps dual-writing during soak (gogobee_legacy_migration.md §6.1).
`ALTER TABLE player_meta ADD COLUMN hospital_visits INTEGER NOT NULL DEFAULT 0`,
}
for _, stmt := range columnMigrations {
if _, err := d.Exec(stmt); err != nil {
@@ -1710,10 +1714,12 @@ CREATE TABLE IF NOT EXISTS dnd_known_recipe (
-- 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
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,
display_name TEXT NOT NULL DEFAULT '',
hospital_visits INTEGER NOT NULL DEFAULT 0
);
`