summaryrefslogtreecommitdiff
path: root/db
diff options
context:
space:
mode:
authorLin Jen-Shin <godfat@godfat.org>2017-02-06 12:22:55 +0800
committerLin Jen-Shin <godfat@godfat.org>2017-02-14 20:13:54 +0800
commita7702271391524262788accfc78e6ef58b63f88e (patch)
tree1f10ddb9c71e56fe1883e461bc8d96a884b276a8 /db
parentf802ad370e625e7aa2f3023f73c24a8b6f009821 (diff)
downloadgitlab-ce-a7702271391524262788accfc78e6ef58b63f88e.tar.gz
Remove inactive default email services
Note that we no longer generate this by default. This is for clearing legacy default data.
Diffstat (limited to 'db')
-rw-r--r--db/post_migrate/20170206040400_remove_inactive_default_email_services.rb27
1 files changed, 27 insertions, 0 deletions
diff --git a/db/post_migrate/20170206040400_remove_inactive_default_email_services.rb b/db/post_migrate/20170206040400_remove_inactive_default_email_services.rb
new file mode 100644
index 00000000000..18affebde73
--- /dev/null
+++ b/db/post_migrate/20170206040400_remove_inactive_default_email_services.rb
@@ -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