2019-08-06 07:33:51 +00:00
|
|
|
# frozen_string_literal: true
|
|
|
|
|
|
|
|
class RemoveEpicIssuesDefaultRelativePosition < ActiveRecord::Migration[5.2]
|
|
|
|
DOWNTIME = false
|
|
|
|
|
2019-09-04 12:06:06 +00:00
|
|
|
include Gitlab::Database::MigrationHelpers
|
|
|
|
|
|
|
|
disable_ddl_transaction!
|
|
|
|
|
|
|
|
def up
|
|
|
|
# The column won't exist if someone installed EE, downgraded to CE
|
|
|
|
# before it was added in EE, then tries to upgrade CE.
|
|
|
|
if column_exists?(:epic_issues, :relative_position)
|
|
|
|
change_column_null :epic_issues, :relative_position, true
|
|
|
|
change_column_default :epic_issues, :relative_position, from: 1073741823, to: nil
|
|
|
|
else
|
2020-05-15 15:08:04 +00:00
|
|
|
add_column_with_default(:epic_issues, :relative_position, :integer, default: nil, allow_null: true) # rubocop:disable Migration/AddColumnWithDefault
|
2019-09-04 12:06:06 +00:00
|
|
|
end
|
|
|
|
end
|
|
|
|
|
|
|
|
def down
|
|
|
|
change_column_default :epic_issues, :relative_position, from: nil, to: 1073741823
|
|
|
|
change_column_null :epic_issues, :relative_position, false
|
2019-08-06 07:33:51 +00:00
|
|
|
end
|
|
|
|
end
|