diff options
Diffstat (limited to 'db/post_migrate/20220621040800_backfill_imported_issue_search_data.rb')
-rw-r--r-- | db/post_migrate/20220621040800_backfill_imported_issue_search_data.rb | 26 |
1 files changed, 26 insertions, 0 deletions
diff --git a/db/post_migrate/20220621040800_backfill_imported_issue_search_data.rb b/db/post_migrate/20220621040800_backfill_imported_issue_search_data.rb new file mode 100644 index 00000000000..39df2b43168 --- /dev/null +++ b/db/post_migrate/20220621040800_backfill_imported_issue_search_data.rb @@ -0,0 +1,26 @@ +# frozen_string_literal: true + +class BackfillImportedIssueSearchData < Gitlab::Database::Migration[2.0] + disable_ddl_transaction! + restrict_gitlab_migration gitlab_schema: :gitlab_main + + MIGRATION = 'BackfillImportedIssueSearchData' + DELAY_INTERVAL = 120.seconds + + def up + min_value = Gitlab::Database::BackgroundMigration::BatchedMigration.find_by( + job_class_name: "BackfillIssueSearchData" + )&.max_value || BATCH_MIN_VALUE + queue_batched_background_migration( + MIGRATION, + :issues, + :id, + job_interval: DELAY_INTERVAL, + batch_min_value: min_value + ) + end + + def down + delete_batched_background_migration(MIGRATION, :issues, :id, []) + end +end |