diff options
4 files changed, 26 insertions, 9 deletions
diff --git a/app/models/project_services/slack_service.rb b/app/models/project_services/slack_service.rb new file mode 100644 index 00000000000..7324bb8c7e0 --- /dev/null +++ b/app/models/project_services/slack_service.rb @@ -0,0 +1,4 @@ +# Remove this in 9.0, this is just to allow a post-deployment migration to +# rename the service. See https://gitlab.com/gitlab-org/gitlab-ce/issues/25855 +class SlackService < SlackNotificationService +end diff --git a/db/migrate/20161213172958_change_slack_service_to_slack_notification_service.rb b/db/migrate/20161213172958_change_slack_service_to_slack_notification_service.rb index a7278d7b5a6..db839bb3000 100644 --- a/db/migrate/20161213172958_change_slack_service_to_slack_notification_service.rb +++ b/db/migrate/20161213172958_change_slack_service_to_slack_notification_service.rb @@ -1,14 +1,10 @@ class ChangeSlackServiceToSlackNotificationService < ActiveRecord::Migration include Gitlab::Database::MigrationHelpers - DOWNTIME = true - DOWNTIME_REASON = 'Rename SlackService to SlackNotificationService' + DOWNTIME = false - def up - execute("UPDATE services SET type = 'SlackNotificationService' WHERE type = 'SlackService'") - end - - def down - execute("UPDATE services SET type = 'SlackService' WHERE type = 'SlackNotificationService'") + # This migration is a no-op, as it existed in an RC but was then moved: + # db/post_migrate/20161220101029_change_slack_service_to_slack_notification_service_in_batches.rb + def change end end 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 diff --git a/db/schema.rb b/db/schema.rb index 14801b581e6..b17ec20e482 100644 --- a/db/schema.rb +++ b/db/schema.rb @@ -11,7 +11,7 @@ # # It's strongly recommended that you check this file into your version control system. -ActiveRecord::Schema.define(version: 20161213172958) do +ActiveRecord::Schema.define(version: 20161220101029) do # These are extensions that must be enabled in order to support this database enable_extension "plpgsql" |