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
diff options
context:
space:
mode:
Diffstat (limited to 'db/post_migrate/20181030135124_fill_empty_values_in_deployments.rb')
-rw-r--r--db/post_migrate/20181030135124_fill_empty_values_in_deployments.rb25
1 files changed, 25 insertions, 0 deletions
diff --git a/db/post_migrate/20181030135124_fill_empty_values_in_deployments.rb b/db/post_migrate/20181030135124_fill_empty_values_in_deployments.rb
new file mode 100644
index 00000000000..88f3365f02d
--- /dev/null
+++ b/db/post_migrate/20181030135124_fill_empty_values_in_deployments.rb
@@ -0,0 +1,25 @@
+# frozen_string_literal: true
+
+class FillEmptyValuesInDeployments < ActiveRecord::Migration
+ include Gitlab::Database::MigrationHelpers
+
+ DOWNTIME = false
+
+ class Deployments < ActiveRecord::Base
+ self.table_name = 'deployments'
+
+ include EachBatch
+ end
+
+ def up
+ FillEmptyValuesInDeployments::Deployments
+ .where('finished_at IS NULL')
+ .each_batch(of: 10_000) do |relation|
+ relation.update_all('finished_at=created_at')
+ end
+ end
+
+ def down
+ # no-op
+ end
+end