diff options
Diffstat (limited to 'db/post_migrate/20161220101029_change_slack_service_to_slack_notification_service_in_batches.rb')
-rw-r--r-- | db/post_migrate/20161220101029_change_slack_service_to_slack_notification_service_in_batches.rb | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/db/post_migrate/20161220101029_change_slack_service_to_slack_notification_service_in_batches.rb b/db/post_migrate/20161220101029_change_slack_service_to_slack_notification_service_in_batches.rb new file mode 100644 index 00000000000..fd1405298a2 --- /dev/null +++ b/db/post_migrate/20161220101029_change_slack_service_to_slack_notification_service_in_batches.rb @@ -0,0 +1,17 @@ +class ChangeSlackServiceToSlackNotificationServiceInBatches < ActiveRecord::Migration + include Gitlab::Database::MigrationHelpers + + DOWNTIME = false + + def up + update_column_in_batches(:services, :type, 'SlackNotificationService') do |table, query| + query.where(table[:type].eq('SlackService')) + end + end + + def down + update_column_in_batches(:services, :type, 'SlackService') do |table, query| + query.where(table[:type].eq('SlackNotificationService')) + end + end +end |