First enable SQL on your site by doing:
./launcher enter app rails c > SiteSetting.enable_badge_sql = true
Then read @sam’s guide below and follow the code: