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

class AddEpicsRelativePosition < Gitlab::Database::Migration[1.0]
  DOWNTIME = false

  def up
    return unless table_exists?(:epics)
    return if column_exists?(:epics, :relative_position)

    add_column :epics, :relative_position, :integer

    execute('UPDATE epics SET relative_position=id*500')
  end

  def down
    # no-op - this column should normally exist if epics table exists too
  end
end