START TRANSACTION;

DELETE FROM role_permissions
WHERE permission_id IN (
  SELECT id
  FROM (
    SELECT id
    FROM permissions
    WHERE code IN (
      'cashier_leaderboard.view',
      'cashier_ratings.view',
      'cashier_ratings.export'
    )
  ) AS legacy_cashier_permissions
);

DELETE FROM permissions
WHERE code IN (
  'cashier_leaderboard.view',
  'cashier_ratings.view',
  'cashier_ratings.export'
);

COMMIT;
