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:
authorGrzegorz Bizon <grzesiek.bizon@gmail.com>2017-08-22 15:58:10 +0300
committerGrzegorz Bizon <grzesiek.bizon@gmail.com>2017-08-22 15:58:10 +0300
commit2e91f18143d42831c37b7429c3583fbd9b4d49b8 (patch)
treeacb3a7ec63872f77a0d71c51df27e1831994ce32 /db/post_migrate
parent3366e38cc1632eba4c9e8683555c6fde6efd5d48 (diff)
parent78a0d27e98cea4ed1b59377edc93588127b297fe (diff)
Merge branch 'master' into backstage/gb/rename-ci-cd-processing-sidekiq-queues
* master: (115 commits) Use event-based waiting in Gitlab::JobWaiter Make sure repository's removal work for legacy and hashed storages Use `@hashed` prefix for hashed paths on disk, to avoid collision with existing ones Refactor project and storage types Prevent using gitlab import task when hashed storage is enabled Some codestyle changes and fixes for GitLab pages Removed some useless code, codestyle changes and removed an index Fix repository reloading in some specs Changelog Moving away from the "extend" based factory to a more traditional one. Enable automatic hashed storage for new projects by application settings New storage is now "Hashed" instead of "UUID" Add UUID Storage to Project Move create_repository back to project model as we can use disk_path and share it Codestyle: move hooks to the same place and move dependent methods to private Use non-i18n values for setting new group-level issue/MR button text indexes external issue tracker copyedit indexes user/search/ from /user/index Correctly encode string params for Gitaly's TreeEntries RPC ...
Diffstat (limited to 'db/post_migrate')
-rw-r--r--db/post_migrate/20170711145558_migrate_stages_statuses.rb33
1 files changed, 33 insertions, 0 deletions
diff --git a/db/post_migrate/20170711145558_migrate_stages_statuses.rb b/db/post_migrate/20170711145558_migrate_stages_statuses.rb
new file mode 100644
index 00000000000..5a24fb1307f
--- /dev/null
+++ b/db/post_migrate/20170711145558_migrate_stages_statuses.rb
@@ -0,0 +1,33 @@
+class MigrateStagesStatuses < ActiveRecord::Migration
+ include Gitlab::Database::MigrationHelpers
+
+ DOWNTIME = false
+
+ disable_ddl_transaction!
+
+ BATCH_SIZE = 10000
+ RANGE_SIZE = 1000
+ MIGRATION = 'MigrateStageStatus'.freeze
+
+ class Stage < ActiveRecord::Base
+ self.table_name = 'ci_stages'
+ include ::EachBatch
+ end
+
+ def up
+ Stage.where(status: nil).each_batch(of: BATCH_SIZE) do |relation, index|
+ relation.each_batch(of: RANGE_SIZE) do |batch|
+ range = relation.pluck('MIN(id)', 'MAX(id)').first
+ schedule = index * 5.minutes
+
+ BackgroundMigrationWorker.perform_in(schedule, MIGRATION, range)
+ end
+ end
+ end
+
+ def down
+ disable_statement_timeout
+
+ update_column_in_batches(:ci_stages, :status, nil)
+ end
+end