diff options
author | Brett Walker <bwalker@gitlab.com> | 2019-07-10 01:34:44 +0300 |
---|---|---|
committer | Brett Walker <bwalker@gitlab.com> | 2019-07-22 18:48:46 +0300 |
commit | b0eafaaca10ce291490ee8b69cae0ce7592c1694 (patch) | |
tree | ec8e0534c49c13c8fad958fcbe5f4e9d5496c3ce /db/migrate | |
parent | 8073b0554fc8f7dddc250025aaf5cedd09f423cb (diff) |
Add index for issues on relative position, project
and state
Diffstat (limited to 'db/migrate')
-rw-r--r-- | db/migrate/20190709220143_add_index_to_issues_relative_position.rb | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/db/migrate/20190709220143_add_index_to_issues_relative_position.rb b/db/migrate/20190709220143_add_index_to_issues_relative_position.rb new file mode 100644 index 00000000000..effab33ce4f --- /dev/null +++ b/db/migrate/20190709220143_add_index_to_issues_relative_position.rb @@ -0,0 +1,20 @@ +# frozen_string_literal: true + +class AddIndexToIssuesRelativePosition < ActiveRecord::Migration[5.1] + include Gitlab::Database::MigrationHelpers + + # Set this constant to true if this migration requires downtime. + DOWNTIME = false + + disable_ddl_transaction! + + INDEX_NAME = 'index_issues_on_project_id_and_state_and_rel_position_and_id'.freeze + + def up + add_concurrent_index :issues, [:project_id, :state, :relative_position, :id], order: { id: :desc }, name: INDEX_NAME + end + + def down + remove_concurrent_index_by_name :issues, INDEX_NAME + end +end |