diff options
Diffstat (limited to 'db/migrate/20220407135820_add_epics_relative_position.rb')
-rw-r--r-- | db/migrate/20220407135820_add_epics_relative_position.rb | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/db/migrate/20220407135820_add_epics_relative_position.rb b/db/migrate/20220407135820_add_epics_relative_position.rb new file mode 100644 index 00000000000..8ab62667e1e --- /dev/null +++ b/db/migrate/20220407135820_add_epics_relative_position.rb @@ -0,0 +1,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 |