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
Léo-Paul Géneau
gitlab-ce
Commits
25cd5aa2
Commit
25cd5aa2
authored
Feb 06, 2017
by
Lin Jen-Shin
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Run two threads to improve migration running time
parent
a7702271
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
17 additions
and
3 deletions
+17
-3
db/post_migrate/20170206040400_remove_inactive_default_email_services.rb
.../20170206040400_remove_inactive_default_email_services.rb
+17
-3
No files found.
db/post_migrate/20170206040400_remove_inactive_default_email_services.rb
View file @
25cd5aa2
...
...
@@ -4,24 +4,38 @@ class RemoveInactiveDefaultEmailServices < ActiveRecord::Migration
DOWNTIME
=
false
def
up
execute
<<-
SQL
.
strip_heredoc
builds_service
=
spawn
<<-
SQL
.
strip_heredoc
DELETE FROM services
WHERE type = 'BuildsEmailService'
AND active =
#{
false_value
}
AND properties = '{"notify_only_broken_builds":true}';
SQL
pipelines_service
=
spawn
<<-
SQL
.
strip_heredoc
DELETE FROM services
WHERE type = 'PipelinesEmailService'
AND active =
#{
false_value
}
AND properties = '{"notify_only_broken_pipelines":true}';
SQL
[
builds_service
,
pipelines_service
].
each
(
&
:join
)
end
def
false_value
quote
(
false
)
private
def
spawn
(
query
)
Thread
.
new
do
ActiveRecord
::
Base
.
connection_pool
.
with_connection
do
ActiveRecord
::
Base
.
connection
.
execute
(
query
)
end
end
end
def
quote
(
value
)
ActiveRecord
::
Base
.
connection
.
quote
(
value
)
end
def
false_value
quote
(
false
)
end
end
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