diff options
Diffstat (limited to 'app/services/projects/destroy_service.rb')
-rw-r--r-- | app/services/projects/destroy_service.rb | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/app/services/projects/destroy_service.rb b/app/services/projects/destroy_service.rb index 7ba5b6119b9..033d90abc7a 100644 --- a/app/services/projects/destroy_service.rb +++ b/app/services/projects/destroy_service.rb @@ -159,6 +159,7 @@ module Projects destroy_web_hooks! destroy_project_bots! destroy_ci_records! + destroy_deployments! destroy_mr_diff_relations! destroy_merge_request_diffs! @@ -253,6 +254,12 @@ module Projects ) end + def destroy_deployments! + project.deployments.each_batch(of: BATCH_SIZE) do |deployments| + deployments.fast_destroy_all + end + end + # The project can have multiple webhooks with hundreds of thousands of web_hook_logs. # By default, they are removed with "DELETE CASCADE" option defined via foreign_key. # But such queries can exceed the statement_timeout limit and fail to delete the project. |