Upgrading to 1.21, postgresql migration fails

Problem:
I have upgraded foreman from 1.20 to 1.21 but db migrate fails.

Foreman and Proxy versions:
1.21

Foreman and Proxy plugin versions:
1.21

Other relevant data:
This is a stretch system and the upgrade has been done using deb.theforeman.org repository.
After installing 1.21 packages, when I run ‘foreman-rake db:migrate’ I get the following:

# 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.                    
rake aborted!                                                                                         
MultiJson::AdapterError: Did not recognize your adapter specification (cannot load such file -- oj/oj).      
/usr/share/foreman/vendor/ruby/2.5.0/gems/polyglot-0.3.5/lib/polyglot.rb:65:in `require'              
/usr/share/foreman/vendor/ruby/2.5.0/gems/polyglot-0.3.5/lib/polyglot.rb:65:in `require'            
/usr/share/foreman/vendor/ruby/2.5.0/gems/activesupport-5.2.1/lib/active_support/dependencies.rb:287:in `block in require'
/usr/share/foreman/vendor/ruby/2.5.0/gems/activesupport-5.2.1/lib/active_support/dependencies.rb:253:in `load_dependency' 
/usr/share/foreman/vendor/ruby/2.5.0/gems/activesupport-5.2.1/lib/active_support/dependencies.rb:287:in `require'         
/usr/lib/ruby/vendor_ruby/oj.rb:43:in `<top (required)>'                                                                             
/usr/share/foreman/vendor/ruby/2.5.0/gems/polyglot-0.3.5/lib/polyglot.rb:65:in `require'                                
/usr/share/foreman/vendor/ruby/2.5.0/gems/polyglot-0.3.5/lib/polyglot.rb:65:in `require'                            
/usr/share/foreman/vendor/ruby/2.5.0/gems/activesupport-5.2.1/lib/active_support/dependencies.rb:287:in `block in require'
/usr/share/foreman/vendor/ruby/2.5.0/gems/activesupport-5.2.1/lib/active_support/dependencies.rb:253:in `load_dependency'
/usr/share/foreman/vendor/ruby/2.5.0/gems/activesupport-5.2.1/lib/active_support/dependencies.rb:287:in `require'
/usr/share/foreman/vendor/ruby/2.5.0/gems/multi_json-1.13.1/lib/multi_json/adapters/oj.rb:2:in `<top (required)>'
/usr/share/foreman/vendor/ruby/2.5.0/gems/polyglot-0.3.5/lib/polyglot.rb:65:in `require'                           
/usr/share/foreman/vendor/ruby/2.5.0/gems/polyglot-0.3.5/lib/polyglot.rb:65:in `require'                          
/usr/share/foreman/vendor/ruby/2.5.0/gems/activesupport-5.2.1/lib/active_support/dependencies.rb:287:in `block in require'
/usr/share/foreman/vendor/ruby/2.5.0/gems/activesupport-5.2.1/lib/active_support/dependencies.rb:253:in `load_dependency'
/usr/share/foreman/vendor/ruby/2.5.0/gems/activesupport-5.2.1/lib/active_support/dependencies.rb:287:in `require'
/usr/share/foreman/vendor/ruby/2.5.0/gems/multi_json-1.13.1/lib/multi_json.rb:157:in `load_adapter_from_string_name'
/usr/share/foreman/vendor/ruby/2.5.0/gems/multi_json-1.13.1/lib/multi_json.rb:101:in `load_adapter'            
/usr/share/foreman/vendor/ruby/2.5.0/gems/multi_json-1.13.1/lib/multi_json.rb:103:in `load_adapter'
/usr/share/foreman/vendor/ruby/2.5.0/gems/multi_json-1.13.1/lib/multi_json.rb:91:in `use'
/usr/share/foreman/vendor/ruby/2.5.0/gems/multi_json-1.13.1/lib/multi_json.rb:73:in `adapter'
/usr/share/foreman/vendor/ruby/2.5.0/gems/multi_json-1.13.1/lib/multi_json.rb:133:in `current_adapter'
/usr/share/foreman/vendor/ruby/2.5.0/gems/multi_json-1.13.1/lib/multi_json.rb:139:in `dump'
/usr/share/foreman/vendor/ruby/2.5.0/gems/dynflow-1.3.0/lib/dynflow/persistence_adapters/sequel.rb:378:in `dump_data'
/usr/share/foreman/vendor/ruby/2.5.0/gems/dynflow-1.3.0/lib/dynflow/persistence_adapters/sequel.rb:267:in `prepare_record'
/usr/share/foreman/vendor/ruby/2.5.0/gems/dynflow-1.3.0/lib/dynflow/persistence_adapters/sequel.rb:294:in `save'
/usr/share/foreman/vendor/ruby/2.5.0/gems/dynflow-1.3.0/lib/dynflow/persistence_adapters/sequel.rb:207:in `insert_coordinator_record'
/usr/share/foreman/vendor/ruby/2.5.0/gems/dynflow-1.3.0/lib/dynflow/coordinator_adapters/sequel.rb:11:in `create_record'
/usr/share/foreman/vendor/ruby/2.5.0/gems/dynflow-1.3.0/lib/dynflow/coordinator.rb:351:in `create_record'
/usr/share/foreman/vendor/ruby/2.5.0/gems/dynflow-1.3.0/lib/dynflow/coordinator.rb:382:in `register_world'
/usr/share/foreman/vendor/ruby/2.5.0/gems/dynflow-1.3.0/lib/dynflow/world.rb:91:in `update_register'
/usr/share/foreman/vendor/ruby/2.5.0/gems/dynflow-1.3.0/lib/dynflow/world.rb:52:in `initialize'
/usr/share/foreman/vendor/ruby/2.5.0/gems/dynflow-1.3.0/lib/dynflow/rails/configuration.rb:78:in `new'
/usr/share/foreman/vendor/ruby/2.5.0/gems/dynflow-1.3.0/lib/dynflow/rails/configuration.rb:78:in `initialize_world'
/usr/share/foreman/vendor/ruby/2.5.0/gems/dynflow-1.3.0/lib/dynflow/rails.rb:104:in `init_world'
/usr/share/foreman/vendor/ruby/2.5.0/gems/dynflow-1.3.0/lib/dynflow/rails.rb:37:in `initialize!'
/usr/share/foreman/config/application.rb:312:in `init_dynflow'
/usr/share/foreman/vendor/ruby/2.5.0/gems/railties-5.2.1/lib/rails/railtie.rb:190:in `public_send'
/usr/share/foreman/vendor/ruby/2.5.0/gems/railties-5.2.1/lib/rails/railtie.rb:190:in `method_missing'
/usr/share/foreman/config/application.rb:287:in `block in <class:Application>'

Any help would be appreciated.

thank you

The problem finally was that I was missing OJ Json engine. just had to add 'gem ‘oj’ to foreman Gemfile. After this, postgres migration succeed.