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/20210615234935_fix_batched_migrations_old_format_job_arguments.rb')
-rw-r--r--db/post_migrate/20210615234935_fix_batched_migrations_old_format_job_arguments.rb32
1 files changed, 0 insertions, 32 deletions
diff --git a/db/post_migrate/20210615234935_fix_batched_migrations_old_format_job_arguments.rb b/db/post_migrate/20210615234935_fix_batched_migrations_old_format_job_arguments.rb
deleted file mode 100644
index 818aea39762..00000000000
--- a/db/post_migrate/20210615234935_fix_batched_migrations_old_format_job_arguments.rb
+++ /dev/null
@@ -1,32 +0,0 @@
-# frozen_string_literal: true
-
-class FixBatchedMigrationsOldFormatJobArguments < ActiveRecord::Migration[6.1]
- class BatchedMigration < ActiveRecord::Base
- self.table_name = 'batched_background_migrations'
- end
-
- def up
- # rubocop:disable Style/WordArray
- [
- ['events', 'id', ['id', 'id_convert_to_bigint'], [['id'], ['id_convert_to_bigint']]],
- ['push_event_payloads', 'event_id', ['event_id', 'event_id_convert_to_bigint'], [['event_id'], ['event_id_convert_to_bigint']]]
- ].each do |table_name, column_name, legacy_job_arguments, current_job_arguments|
- base_scope = BatchedMigration
- .where(job_class_name: 'CopyColumnUsingBackgroundMigrationJob', table_name: table_name, column_name: column_name)
- # rubocop:enable Style/WordArray
-
- # rubocop:disable Rails/WhereEquals
- base_scope
- .where('job_arguments = ?', Gitlab::Json.dump(legacy_job_arguments))
- .where('NOT EXISTS (?)', base_scope.select('1').where('job_arguments = ?', Gitlab::Json.dump(current_job_arguments)))
- .update_all(job_arguments: current_job_arguments)
- # rubocop:enable Rails/WhereEquals
- end
- end
-
- def down
- # No-op, there is no way to know were the existing record migrated from
- # legacy job arguments, or were using the current format from the start.
- # There is no reason to go back anyway.
- end
-end