Skip to content

Commit

Permalink
Modernise migrations
Browse files Browse the repository at this point in the history
  • Loading branch information
tomhughes committed Jul 13, 2016
1 parent 5fd4fd1 commit 600743f
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions db/migrate/021_move_to_innodb.rb
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,8 @@ def self.up
# As the initial version of all nodes, ways and relations is 0, we set the
# current version to something less so that we can update the version in
# batches of 10000
tbl.classify.constantize.update_all("version=-1")
while tbl.classify.constantize.count(:conditions => { :version => -1 }) > 0
tbl.classify.constantize.update_all(:version => -1)
while tbl.classify.constantize.where(:version => -1).count > 0
tbl.classify.constantize.update_all("version=(SELECT max(version) FROM #{tbl} WHERE #{tbl}.id = current_#{tbl}.id)", { :version => -1 }, { :limit => 10000 })
end
# execute "UPDATE current_#{tbl} SET version = " +
Expand Down

0 comments on commit 600743f

Please sign in to comment.