Commit 82661deb authored by Adam Hegyi's avatar Adam Hegyi

Merge branch '288005-events-indexes-async-creation' into 'master'

Prepare indexes on events for bigint column conversions

See merge request gitlab-org/gitlab!68426
parents 674d02a4 e0574593
# frozen_string_literal: true
class PrepareIndexesForEventsBigintConversion < ActiveRecord::Migration[6.1]
include Gitlab::Database::MigrationHelpers
TABLE_NAME = 'events'
def up
prepare_async_index TABLE_NAME, :id_convert_to_bigint, unique: true,
name: :index_events_on_id_convert_to_bigint
prepare_async_index TABLE_NAME, [:project_id, :id_convert_to_bigint],
name: :index_events_on_project_id_and_id_convert_to_bigint
prepare_async_index TABLE_NAME, [:project_id, :id_convert_to_bigint], order: { id_convert_to_bigint: :desc },
where: 'action = 7', name: :index_events_on_project_id_and_id_bigint_desc_on_merged_action
end
def down
unprepare_async_index_by_name TABLE_NAME, :index_events_on_id_convert_to_bigint
unprepare_async_index_by_name TABLE_NAME, :index_events_on_project_id_and_id_convert_to_bigint
unprepare_async_index_by_name TABLE_NAME, :index_events_on_project_id_and_id_bigint_desc_on_merged_action
end
end
360bb1c16c93d7a6564ed70fa2dea4212e1fd00d101cfdc9017b54f67eae797d
\ No newline at end of file
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