diff options
author | Yorick Peterse <yorickpeterse@gmail.com> | 2018-09-25 15:46:25 +0000 |
---|---|---|
committer | Yorick Peterse <yorickpeterse@gmail.com> | 2018-09-25 15:46:25 +0000 |
commit | 45b365b0e5abdb86ff6ac23b00578d5398134af9 (patch) | |
tree | e14489a6d5563fcff15d6b33a5b7f9f7d83ffc4d | |
parent | b84b7433c620411170b6b3f4a5a5046d2ac912af (diff) | |
parent | 18223f0522dbf3a1697f777533bd5e14dfb62e89 (diff) | |
download | gitlab-ce-45b365b0e5abdb86ff6ac23b00578d5398134af9.tar.gz |
Merge branch 'osw-clean-up-phase-for-diff-files-removal' into 'master'
Add clean-up phase for ScheduleDiffFilesDeletion migration
Closes #51469
See merge request gitlab-org/gitlab-ce!21734
-rw-r--r-- | changelogs/unreleased/osw-clean-up-phase-for-diff-files-removal.yml | 5 | ||||
-rw-r--r-- | db/post_migrate/20180913051323_consume_remaining_diff_files_deletion_jobs.rb | 23 |
2 files changed, 28 insertions, 0 deletions
diff --git a/changelogs/unreleased/osw-clean-up-phase-for-diff-files-removal.yml b/changelogs/unreleased/osw-clean-up-phase-for-diff-files-removal.yml new file mode 100644 index 00000000000..03189d934a7 --- /dev/null +++ b/changelogs/unreleased/osw-clean-up-phase-for-diff-files-removal.yml @@ -0,0 +1,5 @@ +--- +title: Add clean-up phase for ScheduleDiffFilesDeletion migration +merge_request: 21734 +author: +type: other diff --git a/db/post_migrate/20180913051323_consume_remaining_diff_files_deletion_jobs.rb b/db/post_migrate/20180913051323_consume_remaining_diff_files_deletion_jobs.rb new file mode 100644 index 00000000000..ed9422a3894 --- /dev/null +++ b/db/post_migrate/20180913051323_consume_remaining_diff_files_deletion_jobs.rb @@ -0,0 +1,23 @@ +# frozen_string_literal: true + +class ConsumeRemainingDiffFilesDeletionJobs < ActiveRecord::Migration + include Gitlab::Database::MigrationHelpers + + DOWNTIME = false + + disable_ddl_transaction! + + MIGRATION = 'ScheduleDiffFilesDeletion'.freeze + TMP_INDEX = 'tmp_partial_diff_id_with_files_index'.freeze + + def up + # Perform any ongoing background migration that might still be scheduled. + Gitlab::BackgroundMigration.steal(MIGRATION) + + remove_concurrent_index_by_name(:merge_request_diffs, TMP_INDEX) + end + + def down + add_concurrent_index(:merge_request_diffs, :id, where: "(state NOT IN ('without_files', 'empty'))", name: TMP_INDEX) + end +end |