2017-05-23 12:57:03 +00:00
|
|
|
# rubocop:disable Migration/UpdateColumnInBatches
|
2018-11-13 07:27:31 +00:00
|
|
|
class RenameSlackAndMattermostNotificationServices < ActiveRecord::Migration[4.2]
|
2016-12-21 19:41:46 +00:00
|
|
|
include Gitlab::Database::MigrationHelpers
|
|
|
|
|
|
|
|
DOWNTIME = false
|
|
|
|
|
2017-06-21 12:35:06 +00:00
|
|
|
disable_ddl_transaction!
|
|
|
|
|
2016-12-21 19:41:46 +00:00
|
|
|
def up
|
|
|
|
update_column_in_batches(:services, :type, 'SlackService') do |table, query|
|
|
|
|
query.where(table[:type].eq('SlackNotificationService'))
|
|
|
|
end
|
|
|
|
|
|
|
|
update_column_in_batches(:services, :type, 'MattermostService') do |table, query|
|
|
|
|
query.where(table[:type].eq('MattermostNotificationService'))
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
|
|
|
def down
|
|
|
|
update_column_in_batches(:services, :type, 'SlackNotificationService') do |table, query|
|
|
|
|
query.where(table[:type].eq('SlackService'))
|
|
|
|
end
|
|
|
|
|
|
|
|
update_column_in_batches(:services, :type, 'MattermostNotificationService') do |table, query|
|
|
|
|
query.where(table[:type].eq('MattermostService'))
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|