Bug #7732

DB migration error: undefined method `counter_cache_column' for nil:NilClass

Added by Dominic Cleal about 3 years ago. Updated about 3 years ago.

Status:Closed
Priority:Normal
Assigned To:Dominic Cleal
Category:DB migrations
Target version:Sprint 29
Difficulty: Bugzilla link:
Found in release: Pull request:https://github.com/theforeman/foreman/pull/1805
Story points-
Velocity based estimate-
Release1.6.1Release relationshipAuto

Description

When migrating past #7247 on an RPM installation, you will hit the following error if any Puppet classes are imported:

==  FixCounters: migrating ====================================================
** Invoke fix_cached_counters (first_time)
** Invoke environment
** Execute fix_cached_counters
Correcting cached counters: (this may take a few minutes)
Architecture corrected
Environment corrected
Operatingsystem corrected
Domain corrected
Realm corrected
rake aborted!
An error has occurred, this and all later migrations canceled:

undefined method `counter_cache_column' for nil:NilClass
/opt/rh/ruby193/root/usr/share/gems/gems/activerecord-3.2.8/lib/active_record/counter_cache.rb:32:in `block in reset_counters'
/opt/rh/ruby193/root/usr/share/gems/gems/activerecord-3.2.8/lib/active_record/counter_cache.rb:19:in `each'
/opt/rh/ruby193/root/usr/share/gems/gems/activerecord-3.2.8/lib/active_record/counter_cache.rb:19:in `reset_counters'
/usr/share/foreman/lib/tasks/fix_cached_counters.rake:8:in `block (2 levels) in <top (required)>'
/usr/share/foreman/lib/tasks/fix_cached_counters.rake:8:in `each'
/usr/share/foreman/lib/tasks/fix_cached_counters.rake:8:in `block in <top (required)>'

Related issues

Related to Foreman - Bug #7247: Create migration to fix incorrect counts caused by #5692 ... Closed 08/25/2014

Associated revisions

Revision ea52e8a8
Added by Dominic Cleal about 3 years ago

fixes #7732 - specify join models as Rails 3.2.8 can't reset through associations

Revision a41ff284
Added by Dominic Cleal about 3 years ago

fixes #7732 - specify join models as Rails 3.2.8 can't reset through associations

(cherry picked from commit ea52e8a8fac02fc34f0dbc90252d1316407afdd7)

History

#1 Updated by Dominic Cleal about 3 years ago

  • Related to Bug #7247: Create migration to fix incorrect counts caused by #5692 and related bugs added

#2 Updated by The Foreman Bot about 3 years ago

  • Status changed from Assigned to Ready For Testing
  • Pull request https://github.com/theforeman/foreman/pull/1805 added

#3 Updated by Dmitry Sakun about 3 years ago

Worked fine for me after applying the patch. Thanks !

#4 Updated by Dmitry Sakun about 3 years ago

'foreman-rake fix_cached_counters' finished without any errors on foreman-release-1.7.0-0.develop.201409281010git52e5d8d.el6.noarch

#5 Updated by Dominic Cleal about 3 years ago

  • Release changed from 1.7.0 to 1.6.1

#6 Updated by Dominic Cleal about 3 years ago

  • Status changed from Ready For Testing to Closed
  • % Done changed from 0 to 100

Also available in: Atom PDF