Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
path: root/db
diff options
context:
space:
mode:
Diffstat (limited to 'db')
-rw-r--r--db/migrate/20161213172958_change_slack_service_to_slack_notification_service.rb12
-rw-r--r--db/post_migrate/20161220101029_change_slack_service_to_slack_notification_service_in_batches.rb17
-rw-r--r--db/schema.rb2
3 files changed, 22 insertions, 9 deletions
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"