diff options
Diffstat (limited to 'db/migrate/20210818185548_add_tag_ids_index_to_ci_pending_build.rb')
-rw-r--r-- | db/migrate/20210818185548_add_tag_ids_index_to_ci_pending_build.rb | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/db/migrate/20210818185548_add_tag_ids_index_to_ci_pending_build.rb b/db/migrate/20210818185548_add_tag_ids_index_to_ci_pending_build.rb new file mode 100644 index 00000000000..b8e00ed9db0 --- /dev/null +++ b/db/migrate/20210818185548_add_tag_ids_index_to_ci_pending_build.rb @@ -0,0 +1,17 @@ +# frozen_string_literal: true + +class AddTagIdsIndexToCiPendingBuild < ActiveRecord::Migration[6.1] + include Gitlab::Database::MigrationHelpers + + disable_ddl_transaction! + + INDEX_NAME = 'index_ci_pending_builds_on_tag_ids' + + def up + add_concurrent_index(:ci_pending_builds, :tag_ids, name: INDEX_NAME, where: 'cardinality(tag_ids) > 0') + end + + def down + remove_concurrent_index_by_name(:ci_pending_builds, name: INDEX_NAME) + end +end |