Commit 0af25745 authored by Matija Čupić's avatar Matija Čupić

Schedule background migration

Schedule artifact expiry backfill migration for execution.
parent e8e21745
# frozen_string_literal: true
class ScheduleBackfillingArtifactExpiryMigration < ActiveRecord::Migration[6.0]
include Gitlab::Database::MigrationHelpers
DOWNTIME = false
INDEX_NAME = 'expired_artifacts_temp_index'
INDEX_CONDITION = 'expire_at IS NULL'
disable_ddl_transaction!
def up
# Create temporary index for expired artifacts
# Needs to be removed in a later migration
add_concurrent_index(:ci_job_artifacts, :expire_at, where: INDEX_CONDITION, name: INDEX_NAME)
queue_background_migration_jobs_by_range_at_intervals(
::Ci::JobArtifact.where(expire_at: nil),
::Gitlab::BackgroundMigration::BackfillArtifactExpiryDate,
2.minutes,
batch_size: 100_000
)
end
def down
# no-op
end
end
68971e7f9a722e98d9e611f614b5465de83ff3d4dc8c7a8078ed1db8f21e6590
\ No newline at end of file
......@@ -20756,6 +20756,8 @@ CREATE UNIQUE INDEX epic_user_mentions_on_epic_id_and_note_id_index ON epic_user
CREATE UNIQUE INDEX epic_user_mentions_on_epic_id_index ON epic_user_mentions USING btree (epic_id) WHERE (note_id IS NULL);
CREATE INDEX expired_artifacts_temp_index ON ci_job_artifacts USING btree (expire_at) WHERE (expire_at IS NULL);
CREATE INDEX finding_links_on_vulnerability_occurrence_id ON vulnerability_finding_links USING btree (vulnerability_occurrence_id);
CREATE INDEX idx_audit_events_on_entity_id_desc_author_id_created_at ON audit_events_archived USING btree (entity_id, entity_type, id DESC, author_id, created_at);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment