diff options
author | Shinya Maeda <shinya@gitlab.com> | 2018-05-04 20:47:23 +0900 |
---|---|---|
committer | Shinya Maeda <shinya@gitlab.com> | 2018-05-04 20:47:23 +0900 |
commit | ecf8287ce5f81aafefaa7b505f620c22527515d9 (patch) | |
tree | 2d51e121fdc707ab4b2a07858bfd59ffceae2ba8 /app/models | |
parent | 8fd76a752b2a67d1b0c15615be7a8b740e1ce082 (diff) | |
download | gitlab-ce-ecf8287ce5f81aafefaa7b505f620c22527515d9.tar.gz |
Use prepend: true to evaluate always perform_fast_destroy than dependent: :destroy
Diffstat (limited to 'app/models')
-rw-r--r-- | app/models/concerns/fast_destroy_all.rb | 2 | ||||
-rw-r--r-- | app/models/project.rb | 3 |
2 files changed, 1 insertions, 4 deletions
diff --git a/app/models/concerns/fast_destroy_all.rb b/app/models/concerns/fast_destroy_all.rb index 367a2df854f..7ea042c6742 100644 --- a/app/models/concerns/fast_destroy_all.rb +++ b/app/models/concerns/fast_destroy_all.rb @@ -74,7 +74,7 @@ module FastDestroyAll # This method is to be defined on models which have fast destroyable models as children, # and let us avoid to use `dependent: :destroy` hook def use_fast_destroy(relation) - before_destroy do + before_destroy(prepend: true) do perform_fast_destroy(public_send(relation)) # rubocop:disable GitlabSecurity/PublicSend end end diff --git a/app/models/project.rb b/app/models/project.rb index dfe3a989c2c..e48ecea1053 100644 --- a/app/models/project.rb +++ b/app/models/project.rb @@ -80,9 +80,6 @@ class Project < ActiveRecord::Base before_destroy :remove_private_deploy_keys - ## - # `use_fast_destroy` must be defined **before** `has_many` and `has_one` such as `has_many :relation, dependent: :destroy` - # Otherwise `use_fast_destroy` performs against **deleted** rows, which fails to get identifiers of external data use_fast_destroy :build_trace_chunks after_destroy -> { run_after_commit { remove_pages } } |