Add Planner to user statistics
What does this MR do and why?
Related to #482733 (closed) (task: Add Planner to user statistics (#504309 - closed))
Follow-up to Add new static role Planner (!169256 - merged) that adds with_highest_role_planner field to the users_statistics table to display the role in the User statistics admin page.
Database changes
Migrate Up
bin/rails db:migrate:up:main VERSION=20241029130136
main: == [advisory_lock_connection] object_id: 129020, pg_backend_pid: 83843
main: == 20241029130136 AddWithHighestRolePlannerToUsersStatistics: migrating =======
main: -- add_column(:users_statistics, :with_highest_role_planner, :integer, {:default=>0, :null=>false})
main: -> 0.0161s
main: == 20241029130136 AddWithHighestRolePlannerToUsersStatistics: migrated (0.0206s)
main: == [advisory_lock_connection] object_id: 129020, pg_backend_pid: 83843
Migrate Down
❯ bin/rails db:migrate:down:main VERSION=20241029130136
main: == [advisory_lock_connection] object_id: 129020, pg_backend_pid: 83288
main: == 20241029130136 AddWithHighestRolePlannerToUsersStatistics: reverting =======
main: -- remove_column(:users_statistics, :with_highest_role_planner, :integer, {:default=>0, :null=>false})
main: -> 0.0052s
main: == 20241029130136 AddWithHighestRolePlannerToUsersStatistics: reverted (0.0116s)
main: == [advisory_lock_connection] object_id: 129020, pg_backend_pid: 83288
MR acceptance checklist
Please evaluate this MR against the MR acceptance checklist. It helps you analyze changes to reduce risks in quality, performance, reliability, security, and maintainability.
Screenshots or screen recordings
| Before | After |
|---|---|
![]() |
![]() |
How to set up and validate locally
- In Rails console generate some user statistics data
FactoryBot.create(:users_statistics)
- With an admin user visit the
Users statisticspage (eg. http://gdk-test:3000/admin/dashboard/stats) - Verify the column Users with highest role Planner exists
Edited by Eugenia Grieff

