diff options
Diffstat (limited to 'db/migrate/20210102164121_drop_temporary_index_on_ci_builds.rb')
-rw-r--r-- | db/migrate/20210102164121_drop_temporary_index_on_ci_builds.rb | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/db/migrate/20210102164121_drop_temporary_index_on_ci_builds.rb b/db/migrate/20210102164121_drop_temporary_index_on_ci_builds.rb new file mode 100644 index 00000000000..0ecf194eb97 --- /dev/null +++ b/db/migrate/20210102164121_drop_temporary_index_on_ci_builds.rb @@ -0,0 +1,19 @@ +# frozen_string_literal: true + +class DropTemporaryIndexOnCiBuilds < ActiveRecord::Migration[6.0] + include Gitlab::Database::MigrationHelpers + + DOWNTIME = false + + disable_ddl_transaction! + + INDEX = 'tmp_build_stage_position_index'.freeze + + def up + remove_concurrent_index_by_name :ci_builds, INDEX + end + + def down + add_concurrent_index :ci_builds, [:stage_id, :stage_idx], where: 'stage_idx IS NOT NULL', name: INDEX + end +end |