Fix merge request migration for postgres
This commit is contained in:
parent
ed60b6fc90
commit
c3659ef2e5
1 changed files with 5 additions and 5 deletions
|
@ -1,16 +1,16 @@
|
|||
class ConvertClosedToStateInMergeRequest < ActiveRecord::Migration
|
||||
def up
|
||||
MergeRequest.transaction do
|
||||
MergeRequest.where("closed = 1 AND merged = 1").update_all("state = 'merged'")
|
||||
MergeRequest.where("closed = 1 AND merged = 0").update_all("state = 'closed'")
|
||||
MergeRequest.where("closed = 0").update_all("state = 'opened'")
|
||||
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'")
|
||||
end
|
||||
end
|
||||
|
||||
def down
|
||||
MergeRequest.transaction do
|
||||
MergeRequest.where(state: :closed).update_all("closed = 1")
|
||||
MergeRequest.where(state: :merged).update_all("closed = 1, merged = 1")
|
||||
MergeRequest.where(state: :closed).update_all(closed: true)
|
||||
MergeRequest.where(state: :merged).update_all(closed: true, merged: true)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
Loading…
Reference in a new issue