diff options
Diffstat (limited to 'db/post_migrate/20211028123412_add_async_index_on_events_using_btree_created_at_id.rb')
-rw-r--r-- | db/post_migrate/20211028123412_add_async_index_on_events_using_btree_created_at_id.rb | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/db/post_migrate/20211028123412_add_async_index_on_events_using_btree_created_at_id.rb b/db/post_migrate/20211028123412_add_async_index_on_events_using_btree_created_at_id.rb new file mode 100644 index 00000000000..03e461dfcd0 --- /dev/null +++ b/db/post_migrate/20211028123412_add_async_index_on_events_using_btree_created_at_id.rb @@ -0,0 +1,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 |