summaryrefslogtreecommitdiff
path: root/db/migrate/20200618134723_restore_previous_schema_with_lock_version_indices.rb
blob: 64fdb37338724f016c4b1c60af6ba0b04a5b8f6c (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
# frozen_string_literal: true

class RestorePreviousSchemaWithLockVersionIndices < ActiveRecord::Migration[6.0]
  include Gitlab::Database::MigrationHelpers

  DOWNTIME = false

  disable_ddl_transaction!

  def up
    add_concurrent_index :issues, :lock_version, where: "lock_version IS NULL"
    add_concurrent_index :merge_requests, :lock_version, where: "lock_version IS NULL"
    add_concurrent_index :epics, :lock_version, where: "lock_version IS NULL"
    add_concurrent_index :ci_stages, :id, where: "lock_version IS NULL", name: "tmp_index_ci_stages_lock_version"
    add_concurrent_index :ci_builds, :id, where: "lock_version IS NULL", name: "tmp_index_ci_builds_lock_version"
    add_concurrent_index :ci_pipelines, :id, where: "lock_version IS NULL", name: "tmp_index_ci_pipelines_lock_version"
  end

  def down
    # no-op
  end
end