Merge branch 'make-epics-position-migration-robust' into 'master'
Make epic_issues relative_position migration more robust Closes #66923 See merge request gitlab-org/gitlab-ce!32646
This commit is contained in:
commit
5abc37bd85
1 changed files with 18 additions and 3 deletions
|
@ -3,8 +3,23 @@
|
||||||
class RemoveEpicIssuesDefaultRelativePosition < ActiveRecord::Migration[5.2]
|
class RemoveEpicIssuesDefaultRelativePosition < ActiveRecord::Migration[5.2]
|
||||||
DOWNTIME = false
|
DOWNTIME = false
|
||||||
|
|
||||||
def change
|
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_null :epic_issues, :relative_position, true
|
||||||
change_column_default :epic_issues, :relative_position, from: 1073741823, to: nil
|
change_column_default :epic_issues, :relative_position, from: 1073741823, to: nil
|
||||||
|
else
|
||||||
|
add_column_with_default(:epic_issues, :relative_position, :integer, default: nil, allow_null: true)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
def down
|
||||||
|
change_column_default :epic_issues, :relative_position, from: nil, to: 1073741823
|
||||||
|
change_column_null :epic_issues, :relative_position, false
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
Loading…
Reference in a new issue