2017-09-10 17:25:29 +05:30
|
|
|
# rubocop:disable Migration/UpdateColumnInBatches
|
2018-12-23 12:14:25 +05:30
|
|
|
class RenameSlackAndMattermostNotificationServices < ActiveRecord::Migration[4.2]
|
2017-08-17 22:00:37 +05:30
|
|
|
include Gitlab::Database::MigrationHelpers
|
|
|
|
|
|
|
|
DOWNTIME = false
|
|
|
|
|
2017-09-10 17:25:29 +05:30
|
|
|
disable_ddl_transaction!
|
|
|
|
|
2017-08-17 22:00:37 +05:30
|
|
|
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
|