Project

General

Profile

Bug #27745

rails db:migrate fails while running upgrade

Added by Kavita Gaikwad 5 months ago. Updated 3 months ago.

Status:
Closed
Priority:
Normal
Category:
DB migrations
Target version:
-
Difficulty:
Triaged:
No
Bugzilla link:
Fixed in Releases:
Found in Releases:

Description

Upgrade failed at foreman-rake db:migrate - undefined method `searchable_value='

  1. foreman-rake db:migrate --trace
    • Invoke db:migrate (first_time)
    • Invoke db:load_config (first_time)
    • Invoke environment (first_time)
    • Execute environment
      API controllers newer than Apipie cache! Run apipie:cache rake task to regenerate cache.
    • Execute db:load_config
    • Invoke plugin:refresh_migrations (first_time)
    • Invoke environment
    • Execute plugin:refresh_migrations
    • Execute db:migrate
      20181105061336 CastKeyTypesAndValuesInParameters: migrating ==============
      rake aborted!
      StandardError: An error has occurred, this and all later migrations canceled:

undefined method `searchable_value=' for #<GroupParameter:0x000000000b68ceb8>
/opt/theforeman/tfm-ror52/root/usr/share/gems/gems/activemodel-5.2.1/lib/active_model/attribute_methods.rb:430:in `method_missing'
/usr/share/foreman/app/models/parameter.rb:81:in `set_searchable_value'
/opt/theforeman/tfm-ror52/root/usr/share/gems/gems/activesupport-5.2.1/lib/active_support/callbacks.rb:426:in `block in make_lambda'
/opt/theforeman/tfm-ror52/root/usr/share/gems/gems/activesupport-5.2.1/lib/active_support/callbacks.rb:198:in `block (2 levels) in halting'
/opt/theforeman/tfm-ror52/root/usr/share/gems/gems/activesupport-5.2.1/lib/active_support/callbacks.rb:606:in `block (2 levels) in default_terminator'
/opt/theforeman/tfm-ror52/root/usr/share/gems/gems/activesupport-5.2.1/lib/active_support/callbacks.rb:605:in `catch'
/opt/theforeman/tfm-ror52/root/usr/share/gems/gems/activesupport-5.2.1/lib/active_support/callbacks.rb:605:in `block in default_terminator'
/opt/theforeman/tfm-ror52/root/usr/share/gems/gems/activesupport-5.2.1/lib/active_support/callbacks.rb:199:in `block in halting'
/opt/theforeman/tfm-ror52/root/usr/share/gems/gems/activesupport-5.2.1/lib/active_support/callbacks.rb:513:in `block in invoke_before'
/opt/theforeman/tfm-ror52/root/usr/share/gems/gems/activesupport-5.2.1/lib/active_support/callbacks.rb:513:in `each'
/opt/theforeman/tfm-ror52/root/usr/share/gems/gems/activesupport-5.2.1/lib/active_support/callbacks.rb:513:in `invoke_before'
/opt/theforeman/tfm-ror52/root/usr/share/gems/gems/activesupport-5.2.1/lib/active_support/callbacks.rb:131:in `run_callbacks'
/opt/theforeman/tfm-ror52/root/usr/share/gems/gems/activesupport-5.2.1/lib/active_support/callbacks.rb:816:in `_run_save_callbacks'
/opt/theforeman/tfm-ror52/root/usr/share/gems/gems/activerecord-5.2.1/lib/active_record/callbacks.rb:342:in `create_or_update'
/opt/theforeman/tfm-ror52/root/usr/share/gems/gems/activerecord-5.2.1/lib/active_record/persistence.rb:275:in `save'
/opt/theforeman/tfm-ror52/root/usr/share/gems/gems/activerecord-5.2.1/lib/active_record/validations.rb:46:in `save'


Related issues

Related to Foreman - Bug #26936: Bring back a search of hosts by value of parameterClosed
Related to Foreman - Feature #4127: Array, Boolean and other types support in "hostgroup parameters"Closed

Associated revisions

Revision 12e91cf4 (diff)
Added by Kavita Gaikwad 5 months ago

Fixes #27745 - fix param before_save to run db:migrate (#7010)

  • Fixes #27745 - fix param saving in db:migrate

Before this commit, db:migrate fails on old versions.
Parameter related old migrations fails
with undefined method for 'searchable_value'.
Migration calls update_columns instead of save
method to skip callbacks.

History

#1 Updated by Kavita Gaikwad 5 months ago

  • Related to Bug #26936: Bring back a search of hosts by value of parameter added

#2 Updated by The Foreman Bot 5 months ago

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

#3 Updated by Kavita Gaikwad 5 months ago

  • Related to Feature #4127: Array, Boolean and other types support in "hostgroup parameters" added

#4 Updated by Kavita Gaikwad 5 months ago

  • Status changed from Ready For Testing to Closed

#5 Updated by Tomer Brisker 3 months ago

  • Category set to DB migrations
  • Fixed in Releases 1.24.0 added

Also available in: Atom PDF