Remove inactive default email services
Note that we no longer generate this by default. This is for clearing legacy default data.
This commit is contained in:
parent
f802ad370e
commit
a770227139
|
@ -0,0 +1,4 @@
|
||||||
|
---
|
||||||
|
title: Remove inactive default email services
|
||||||
|
merge_request: 8987
|
||||||
|
author:
|
|
@ -0,0 +1,27 @@
|
||||||
|
class RemoveInactiveDefaultEmailServices < ActiveRecord::Migration
|
||||||
|
include Gitlab::Database::MigrationHelpers
|
||||||
|
|
||||||
|
DOWNTIME = false
|
||||||
|
|
||||||
|
def up
|
||||||
|
execute <<-SQL.strip_heredoc
|
||||||
|
DELETE FROM services
|
||||||
|
WHERE type = 'BuildsEmailService'
|
||||||
|
AND active = #{false_value}
|
||||||
|
AND properties = '{"notify_only_broken_builds":true}';
|
||||||
|
|
||||||
|
DELETE FROM services
|
||||||
|
WHERE type = 'PipelinesEmailService'
|
||||||
|
AND active = #{false_value}
|
||||||
|
AND properties = '{"notify_only_broken_pipelines":true}';
|
||||||
|
SQL
|
||||||
|
end
|
||||||
|
|
||||||
|
def false_value
|
||||||
|
quote(false)
|
||||||
|
end
|
||||||
|
|
||||||
|
def quote(value)
|
||||||
|
ActiveRecord::Base.connection.quote(value)
|
||||||
|
end
|
||||||
|
end
|
Loading…
Reference in New Issue