Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndrew8xx8 <avk@8xx8.ru>2013-02-19 11:32:10 +0400
committerAndrew8xx8 <avk@8xx8.ru>2013-02-19 11:32:10 +0400
commitd58eb62d681b4316daa5eaeff37997ff5750dccf (patch)
treeb9a2e6d72b95424bb39e89d92eefeedf2fab9d8b /db/migrate/20130218141258_convert_closed_to_state_in_issue.rb
parente5f048f44d054c0e825c880f7b58f0288cdc122f (diff)
Migrations iproved
Diffstat (limited to 'db/migrate/20130218141258_convert_closed_to_state_in_issue.rb')
-rw-r--r--db/migrate/20130218141258_convert_closed_to_state_in_issue.rb11
1 files changed, 3 insertions, 8 deletions
diff --git a/db/migrate/20130218141258_convert_closed_to_state_in_issue.rb b/db/migrate/20130218141258_convert_closed_to_state_in_issue.rb
index c20fd634e82..0614a5c0064 100644
--- a/db/migrate/20130218141258_convert_closed_to_state_in_issue.rb
+++ b/db/migrate/20130218141258_convert_closed_to_state_in_issue.rb
@@ -1,19 +1,14 @@
class ConvertClosedToStateInIssue < ActiveRecord::Migration
def up
Issue.transaction do
- Issue.find_each do |issue|
- issue.state = issue.closed? ? :closed : :opened
- issue.save
- end
+ Issue.where(closed: true).update_all("state = 'closed'")
+ Issue.where(closed: false).update_all("state = 'opened'")
end
end
def down
Issue.transaction do
- Issue.find_each do |issue|
- issue.closed = issue.closed?
- issue.save
- end
+ Issue.where(state: :closed).update_all("closed = 1")
end
end
end