diff options
Diffstat (limited to 'db/migrate/20210714043818_add_index_for_label_applied_to_issuable_sla.rb')
-rw-r--r-- | db/migrate/20210714043818_add_index_for_label_applied_to_issuable_sla.rb | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/db/migrate/20210714043818_add_index_for_label_applied_to_issuable_sla.rb b/db/migrate/20210714043818_add_index_for_label_applied_to_issuable_sla.rb new file mode 100644 index 00000000000..5931941a95e --- /dev/null +++ b/db/migrate/20210714043818_add_index_for_label_applied_to_issuable_sla.rb @@ -0,0 +1,17 @@ +# frozen_string_literal: true + +class AddIndexForLabelAppliedToIssuableSla < ActiveRecord::Migration[6.1] + include Gitlab::Database::MigrationHelpers + + disable_ddl_transaction! + + INDEX_NAME = 'index_issuable_slas_on_due_at_id_label_applied_issuable_closed' + + def up + add_concurrent_index :issuable_slas, [:due_at, :id], name: INDEX_NAME, where: 'label_applied = FALSE AND issuable_closed = FALSE' + end + + def down + remove_concurrent_index_by_name :issuable_slas, INDEX_NAME + end +end |