-- ==============================================================================
-- Grant the pediatrics account the immunization module.
--
-- ImmunizationVoter requires BOTH halves: ROLE_DOC and a staff profile whose
-- doctor category is exactly "Pediatrician". The account had ROLE_WARD and no
-- category, so it failed both.
--
-- ROLE_DOC is ADDED, not swapped in: whatever this account does on the ward
-- today keeps working. One visible side effect — DashboardController matches
-- ROLE_DOC before ROLE_WARD, so this user now lands on the doctor dashboard
-- instead of the ward one.
--
-- To revert: set roles back to '["ROLE_WARD"]' and doctor_category_id to NULL.
-- ==============================================================================

UPDATE `users`
SET `roles` = '["ROLE_DOC", "ROLE_WARD"]'
WHERE `username` = 'pediatrics_ward';

UPDATE `staff_profiles` sp
JOIN `users` u ON u.profile_id = sp.id
SET sp.`doctor_category_id` = (
    SELECT id FROM `doctor_categories` WHERE `name` = 'Pediatrician' LIMIT 1
)
WHERE u.`username` = 'pediatrics_ward';
