Welcome to mirror list, hosted at ThFree Co, Russian Federation.

20211028123412_add_async_index_on_events_using_btree_created_at_id.rb « post_migrate « db - gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: 03e461dfcd031dc352d54f14693868e43e9d9c57 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
# frozen_string_literal: true

class AddAsyncIndexOnEventsUsingBtreeCreatedAtId < Gitlab::Database::Migration[1.0]
  INDEX_NAME = 'index_events_on_created_at_and_id'
  TABLE = :events
  COLUMNS = %i[created_at id]
  CONSTRAINTS = "created_at > '2021-08-27'"

  def up
    prepare_async_index TABLE, COLUMNS, name: INDEX_NAME, where: CONSTRAINTS
  end

  def down
    unprepare_async_index TABLE, COLUMNS, name: INDEX_NAME, where: CONSTRAINTS
  end
end