summaryrefslogtreecommitdiff
path: root/db/post_migrate/20200608212030_lock_version_cleanup_for_epics.rb
blob: aafa6a8320002267430e0a852f68fd2ab7f634bf (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
# frozen_string_literal: true

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

  DOWNTIME = false

  disable_ddl_transaction!

  def up
    validate_not_null_constraint :epics, :lock_version
    remove_concurrent_index_by_name :epics, name: 'index_epics_on_id'
  end

  def down
    add_concurrent_index :epics, :id, where: "lock_version IS NULL", name: 'index_epics_on_id'
  end
end