Project

General

Profile

« Previous | Next » 

Revision 678e2339

Added by Tomer Brisker over 7 years ago

Fixes #17666 - prevent migration failures on counter cache

Removal of counter cache causes migrations relying on the
`reset_counters` method to fail. The migrations are changed to not
update the counters (which are now removed anyways).

(cherry picked from commit 1f6cc22ba15af8ed0d85cc882cb6878c282e2dd2)

View differences:

db/migrate/20151104100257_add_hosts_count_to_hostgroup.rb
class AddHostsCountToHostgroup < ActiveRecord::Migration
def up
add_column :hostgroups, :hosts_count, :integer, :default => 0
Hostgroup.all.each do |hg|
Hostgroup.reset_counters(hg.id, :hosts)
end
end
def down

Also available in: Unified diff