fix: create user_binary row on character creation (#176)

New characters were missing their user_binary record, preventing them
from entering their house. Both sign server and API character creation
paths now insert the row. A backfill migration fixes existing databases.
This commit is contained in:
Houmgaor
2026-03-16 17:11:55 +01:00
parent 1ae7dffe7b
commit 5009a37d19
3 changed files with 19 additions and 3 deletions

View File

@@ -24,13 +24,19 @@ func (r *SignCharacterRepository) CountNewCharacters(uid uint32) (int, error) {
}
func (r *SignCharacterRepository) CreateCharacter(uid uint32, lastLogin uint32) error {
_, err := r.db.Exec(`
var charID int
err := r.db.QueryRow(`
INSERT INTO characters (
user_id, is_female, is_new_character, name, unk_desc_string,
hr, gr, weapon_type, last_login)
VALUES($1, False, True, '', '', 0, 0, 0, $2)`,
VALUES($1, False, True, '', '', 0, 0, 0, $2)
RETURNING id`,
uid, lastLogin,
)
).Scan(&charID)
if err != nil {
return err
}
_, err = r.db.Exec(`INSERT INTO user_binary (id) VALUES ($1)`, charID)
return err
}