diff --git a/app/models/shipit/commit_deployment.rb b/app/models/shipit/commit_deployment.rb
index <HASH>..<HASH> 100644
--- a/app/models/shipit/commit_deployment.rb
+++ b/app/models/shipit/commit_deployment.rb
@@ -2,7 +2,7 @@ module Shipit
   class CommitDeployment < ActiveRecord::Base
     belongs_to :commit
     belongs_to :task
-    has_many :statuses, class_name: 'CommitDeploymentStatus'
+    has_many :statuses, dependent: :destroy, class_name: 'CommitDeploymentStatus'
 
     after_commit :schedule_create_on_github, on: :create
 
diff --git a/app/models/shipit/deploy.rb b/app/models/shipit/deploy.rb
index <HASH>..<HASH> 100644
--- a/app/models/shipit/deploy.rb
+++ b/app/models/shipit/deploy.rb
@@ -11,7 +11,7 @@ module Shipit
       after_transition any => any, do: :update_commit_deployments
     end
 
-    has_many :commit_deployments, inverse_of: :task, foreign_key: :task_id do
+    has_many :commit_deployments, dependent: :destroy, inverse_of: :task, foreign_key: :task_id do
       GITHUB_STATUSES = {
         'pending' => 'pending',
         'failed' => 'failure',
Add missing dependent: :destroy for CommitDeployment