From 38e1027ac4bb9e7c7f00577bb3fcb1c1fba68d0e Mon Sep 17 00:00:00 2001
From: Joe Woodward <j@joewoodward.me>
Date: Wed, 24 Apr 2024 11:41:44 +0100
Subject: [PATCH] Add `destroy` to bulk_database_action dangerbot suggestions

We already check if the code includes `danger` but the suggestion
comment did not include it which can lead to confusion.
---
 spec/tooling/danger/bulk_database_actions_spec.rb |  1 +
 tooling/danger/bulk_database_actions.rb           | 10 ++++++----
 2 files changed, 7 insertions(+), 4 deletions(-)

diff --git a/spec/tooling/danger/bulk_database_actions_spec.rb b/spec/tooling/danger/bulk_database_actions_spec.rb
index 18a46f663c07e..2ac4ff995f3f8 100644
--- a/spec/tooling/danger/bulk_database_actions_spec.rb
+++ b/spec/tooling/danger/bulk_database_actions_spec.rb
@@ -56,6 +56,7 @@
             'upsert_all',
             'User.upsert',
             'User.last.destroy',
+            'destroy',
             ' .destroy'
           ]
         end
diff --git a/tooling/danger/bulk_database_actions.rb b/tooling/danger/bulk_database_actions.rb
index 7f3edaf76631d..ed2b7c493acd5 100644
--- a/tooling/danger/bulk_database_actions.rb
+++ b/tooling/danger/bulk_database_actions.rb
@@ -10,11 +10,13 @@ class BulkDatabaseActions < Suggestion
       DOCUMENTATION_LINK = 'https://docs.gitlab.com/ee/development/database_review.html#preparation-when-using-bulk-update-operations'
 
       SUGGESTION = <<~MESSAGE_MARKDOWN.freeze
-        When using `update`, `upsert`, `delete`, `update_all`, `upsert_all`, `delete_all` or `destroy_all`
-        you must include the full database query and query execution plan in the merge request description,
-        and request a ~database review.
+        When using `update`, `upsert`, `delete`, `destroy`, `update_all`,
+        `upsert_all`, `delete_all` or `destroy_all` you must include the full
+        database query and query execution plan in the merge request
+        description, and request a ~database review.
 
-        This comment can be ignored if the object is not an ActiveRecord class, since no database query would be generated.
+        This comment can be ignored if the object is not an ActiveRecord class,
+        since no database query would be generated.
 
         ----
 
-- 
GitLab