mirror of
https://github.com/Mezeporta/Erupe.git
synced 2026-03-22 07:32:32 +01:00
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:
@@ -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
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user