START TRANSACTION;

DELETE FROM role_permissions
WHERE permission_id IN (
  SELECT id
  FROM (
    SELECT id
    FROM permissions
    WHERE code IN ('dashboard.main.view', 'dashboard.view')
  ) AS legacy_dashboard_permissions
);

DELETE FROM permissions
WHERE code IN ('dashboard.main.view', 'dashboard.view');

COMMIT;
