Commit 53d0a632 authored by Pedro Pombeiro's avatar Pedro Pombeiro Committed by Adam Hegyi

Add indices for created_at+id and contacted_at+id on ci_runners

Changelog: changed
parent 66a453a5
# frozen_string_literal: true
# See https://docs.gitlab.com/ee/development/migration_style_guide.html
# for more information on how to write migrations for GitLab.
class AddRunnersCreatedAtIndex < ActiveRecord::Migration[6.0]
include Gitlab::Database::MigrationHelpers
disable_ddl_transaction!
INDEX_NAME = 'index_ci_runners_on_created_at_and_id'
def up
add_concurrent_index :ci_runners, [:created_at, :id], name: INDEX_NAME
end
def down
remove_concurrent_index :ci_runners, [:created_at, :id], name: INDEX_NAME
end
end
# frozen_string_literal: true
# See https://docs.gitlab.com/ee/development/migration_style_guide.html
# for more information on how to write migrations for GitLab.
class ReplaceRunnersContactedAtIndex < ActiveRecord::Migration[6.0]
include Gitlab::Database::MigrationHelpers
disable_ddl_transaction!
OLD_INDEX_NAME = 'index_ci_runners_on_contacted_at'
NEW_INDEX_NAME = 'index_ci_runners_on_contacted_at_and_id'
def up
add_concurrent_index :ci_runners, [:contacted_at, :id], name: NEW_INDEX_NAME, using: 'btree'
remove_concurrent_index_by_name :ci_runners, OLD_INDEX_NAME
end
def down
remove_concurrent_index_by_name :ci_runners, NEW_INDEX_NAME
add_concurrent_index :ci_runners, :contacted_at, name: OLD_INDEX_NAME, using: 'btree'
end
end
fc500e4dd555a6baad91ad3c9fb8a2f8541e1613dd64afdbdd28b19447a28caf
\ No newline at end of file
4dcf6277439e8abe52534540100fa621fedcecb3eaf71ad5685ac0230cd2e5bb
\ No newline at end of file
......@@ -22904,7 +22904,9 @@ CREATE INDEX index_ci_runner_projects_on_project_id ON ci_runner_projects USING
CREATE INDEX index_ci_runner_projects_on_runner_id ON ci_runner_projects USING btree (runner_id);
CREATE INDEX index_ci_runners_on_contacted_at ON ci_runners USING btree (contacted_at);
CREATE INDEX index_ci_runners_on_contacted_at_and_id ON ci_runners USING btree (contacted_at, id);
CREATE INDEX index_ci_runners_on_created_at_and_id ON ci_runners USING btree (created_at, id);
CREATE INDEX index_ci_runners_on_description_trigram ON ci_runners USING gin (description gin_trgm_ops);
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