Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
G
gitlab-ce
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Boxiang Sun
gitlab-ce
Commits
ecf8287c
Commit
ecf8287c
authored
May 04, 2018
by
Shinya Maeda
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Use prepend: true to evaluate always perform_fast_destroy than dependent: :destroy
parent
8fd76a75
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
1 addition
and
4 deletions
+1
-4
app/models/concerns/fast_destroy_all.rb
app/models/concerns/fast_destroy_all.rb
+1
-1
app/models/project.rb
app/models/project.rb
+0
-3
No files found.
app/models/concerns/fast_destroy_all.rb
View file @
ecf8287c
...
@@ -74,7 +74,7 @@ module FastDestroyAll
...
@@ -74,7 +74,7 @@ module FastDestroyAll
# This method is to be defined on models which have fast destroyable models as children,
# This method is to be defined on models which have fast destroyable models as children,
# and let us avoid to use `dependent: :destroy` hook
# and let us avoid to use `dependent: :destroy` hook
def
use_fast_destroy
(
relation
)
def
use_fast_destroy
(
relation
)
before_destroy
do
before_destroy
(
prepend:
true
)
do
perform_fast_destroy
(
public_send
(
relation
))
# rubocop:disable GitlabSecurity/PublicSend
perform_fast_destroy
(
public_send
(
relation
))
# rubocop:disable GitlabSecurity/PublicSend
end
end
end
end
...
...
app/models/project.rb
View file @
ecf8287c
...
@@ -80,9 +80,6 @@ class Project < ActiveRecord::Base
...
@@ -80,9 +80,6 @@ class Project < ActiveRecord::Base
before_destroy
:remove_private_deploy_keys
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
use_fast_destroy
:build_trace_chunks
after_destroy
->
{
run_after_commit
{
remove_pages
}
}
after_destroy
->
{
run_after_commit
{
remove_pages
}
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment