UPDATE roles
SET permissions = JSON_REPLACE(permissions, JSON_UNQUOTE(JSON_SEARCH(permissions, 'one', 'dashboard:view')), 'dashboard:overview:view')
WHERE JSON_SEARCH(permissions, 'one', 'dashboard:view') IS NOT NULL;

UPDATE roles
SET permissions = JSON_REPLACE(permissions, JSON_UNQUOTE(JSON_SEARCH(permissions, 'one', 'leads:view')), 'leads:referral:view')
WHERE JSON_SEARCH(permissions, 'one', 'leads:view') IS NOT NULL;

UPDATE roles
SET permissions = JSON_REPLACE(permissions, JSON_UNQUOTE(JSON_SEARCH(permissions, 'one', 'leads:advance')), 'leads:referral:advance')
WHERE JSON_SEARCH(permissions, 'one', 'leads:advance') IS NOT NULL;

UPDATE roles
SET permissions = JSON_REPLACE(permissions, JSON_UNQUOTE(JSON_SEARCH(permissions, 'one', 'points:view')), 'points:account:view')
WHERE JSON_SEARCH(permissions, 'one', 'points:view') IS NOT NULL;

UPDATE roles
SET permissions = JSON_REPLACE(permissions, JSON_UNQUOTE(JSON_SEARCH(permissions, 'one', 'points:adjust')), 'points:account:adjust')
WHERE JSON_SEARCH(permissions, 'one', 'points:adjust') IS NOT NULL;

UPDATE roles
SET permissions = JSON_REPLACE(permissions, JSON_UNQUOTE(JSON_SEARCH(permissions, 'one', 'points:rule')), 'points:rule:edit')
WHERE JSON_SEARCH(permissions, 'one', 'points:rule') IS NOT NULL;

UPDATE roles
SET permissions = JSON_REPLACE(permissions, JSON_UNQUOTE(JSON_SEARCH(permissions, 'one', 'points:reward')), 'points:reward:edit')
WHERE JSON_SEARCH(permissions, 'one', 'points:reward') IS NOT NULL;

UPDATE roles
SET permissions = JSON_REPLACE(permissions, JSON_UNQUOTE(JSON_SEARCH(permissions, 'one', 'courses:view')), 'courses:trial:view')
WHERE JSON_SEARCH(permissions, 'one', 'courses:view') IS NOT NULL;

UPDATE roles
SET permissions = JSON_REPLACE(permissions, JSON_UNQUOTE(JSON_SEARCH(permissions, 'one', 'courses:add')), 'courses:trial:add')
WHERE JSON_SEARCH(permissions, 'one', 'courses:add') IS NOT NULL;

UPDATE roles
SET permissions = JSON_REPLACE(permissions, JSON_UNQUOTE(JSON_SEARCH(permissions, 'one', 'courses:edit')), 'courses:trial:edit')
WHERE JSON_SEARCH(permissions, 'one', 'courses:edit') IS NOT NULL;

UPDATE roles
SET permissions = JSON_REPLACE(permissions, JSON_UNQUOTE(JSON_SEARCH(permissions, 'one', 'courses:delete')), 'courses:trial:delete')
WHERE JSON_SEARCH(permissions, 'one', 'courses:delete') IS NOT NULL;

UPDATE roles
SET permissions = JSON_REPLACE(permissions, JSON_UNQUOTE(JSON_SEARCH(permissions, 'one', 'statistics:view')), 'statistics:channel:view')
WHERE JSON_SEARCH(permissions, 'one', 'statistics:view') IS NOT NULL;
