Project

General

Profile

« Previous | Next » 

Revision 1f6cc22b

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).

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