amtgard / ORK3

Version 3 of the Online Record Keeper
Other
23 stars 12 forks source link

Ork Officer table can have mismatched kingdom_id's preventing officer assignment #341

Closed kenwalker closed 1 month ago

kenwalker commented 1 month ago

For a currently unknown reason, the ork.ork_officer table can end up in a state where an officer has a kingdom_id that does not equal the kingdom_id of where that officer resides. This results in that officer position never being able to be changed. To check for this inconsistency, run this sql query.

SELECT of1.park_id, of1.kingdom_id as officer_kingdom, op1.kingdom_id as park_actual_kingdom
FROM ork.ork_officer AS of1
LEFT JOIN ork.ork_park AS op1 ON of1.park_id = op1.park_id where not of1.park_id = 0 and not of1.kingdom_id = op1.kingdom_id

If this returns rows of mismatches then the following sql query needs to be run

UPDATE ork.ork_officer of1
JOIN ork.ork_park op1 on of1.park_id = op1.park_id
SET of1.kingdom_id = op1.kingdom_id 
where not of1.park_id = 0 and not of1.kingdom_id = op1.kingdom_id
kenwalker commented 1 month ago

This appears to be a bug in “claim park”, the officer tables is not updated to reflect the new kingdom

kenwalker commented 1 month ago

Fix released