Data converting migrations was wrong. Fixed
This commit is contained in:
parent
135418dcbf
commit
4a55c69877
3 changed files with 9 additions and 9 deletions
|
@ -1,14 +1,14 @@
|
|||
class ConvertClosedToStateInIssue < ActiveRecord::Migration
|
||||
def up
|
||||
Issue.transaction do
|
||||
Issue.where(closed: true).update_all("state = 'closed'")
|
||||
Issue.where(closed: false).update_all("state = 'opened'")
|
||||
Issue.where(closed: true).update_all(state: :closed)
|
||||
Issue.where(closed: false).update_all(state: :opened)
|
||||
end
|
||||
end
|
||||
|
||||
def down
|
||||
Issue.transaction do
|
||||
Issue.where(state: :closed).update_all("closed = 1")
|
||||
Issue.where(state: :closed).update_all(closed: true)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
|
@ -1,9 +1,9 @@
|
|||
class ConvertClosedToStateInMergeRequest < ActiveRecord::Migration
|
||||
def up
|
||||
MergeRequest.transaction do
|
||||
MergeRequest.where(closed: true, merged: true).update_all("state = 'merged'")
|
||||
MergeRequest.where(closed: true, merged: true).update_all("state = 'closed'")
|
||||
MergeRequest.where(closed: false).update_all("state = 'opened'")
|
||||
MergeRequest.where(closed: true, merged: true).update_all(state: :merged)
|
||||
MergeRequest.where(closed: true, merged: false).update_all(state: :closed)
|
||||
MergeRequest.where(closed: false).update_all(state: :opened)
|
||||
end
|
||||
end
|
||||
|
||||
|
|
|
@ -1,14 +1,14 @@
|
|||
class ConvertClosedToStateInMilestone < ActiveRecord::Migration
|
||||
def up
|
||||
Milestone.transaction do
|
||||
Milestone.where(closed: false).update_all("state = 'opened'")
|
||||
Milestone.where(closed: false).update_all("state = 'active'")
|
||||
Milestone.where(closed: true).update_all(state: :closed)
|
||||
Milestone.where(closed: false).update_all(state: :active)
|
||||
end
|
||||
end
|
||||
|
||||
def down
|
||||
Milestone.transaction do
|
||||
Milestone.where(state: :closed).update_all("closed = 1")
|
||||
Milestone.where(state: :closed).update_all(closed: true)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
Loading…
Reference in a new issue