Files
DarkflameServer/migrations/dlu/mysql/80_pet_name_lot.sql
Aaron Kimbrell 9682556128 feat: store each named pet's LOT in pet_names
pet_names gets a pet_lot column (mysql 80, sqlite 63). The world writes
it whenever it saves a pet name, from the pet entity's LOT, and fills it
in for older rows when the owner loads into a world (from the pets the
game loads for that character, only where it is still missing).

The dashboard's pet name tables read pet_lot instead of scanning the
owner's character XML; pets without it yet show as Unknown.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-09-28 22:30:57 -05:00

8 lines
573 B
SQL

/* Which kind of pet (its LOT) each named pet is, written by the game when the name is set and filled in for older
rows when the owner next loads into a world. NULL or 0: not known yet. Only added when it is not there yet. */
SET @dlu_column = (SELECT IF(COUNT(*) = 0, 'ALTER TABLE pet_names ADD COLUMN pet_lot INT NULL DEFAULT NULL', 'DO 0') FROM information_schema.columns
WHERE table_schema = DATABASE() AND table_name = 'pet_names' AND column_name = 'pet_lot');
PREPARE dlu_column_stmt FROM @dlu_column;
EXECUTE dlu_column_stmt;
DEALLOCATE PREPARE dlu_column_stmt;