Cannot run database migration command from source with gilab 12-ee

Hello,

I am trying to update my Gitlab installation from community edition to enterprise edition (version 12). However, the database migration failed with the following error:

# sudo -u git -H bundle exec rake db:migrate RAILS_ENV=production --trace
rake aborted!
LoadError: cannot load such file -- rails/all
/home/git/gitlab/config/application.rb:3:in `require'
/home/git/gitlab/config/application.rb:3:in `<top (required)>'
/home/git/gitlab/Rakefile:5:in `require'
/home/git/gitlab/Rakefile:5:in `<top (required)>'
/home/git/gitlab/vendor/bundle/ruby/2.6.0/gems/rake-12.3.2/lib/rake/rake_module.rb:29:in `load'
/home/git/gitlab/vendor/bundle/ruby/2.6.0/gems/rake-12.3.2/lib/rake/rake_module.rb:29:in `load_rakefile'
/home/git/gitlab/vendor/bundle/ruby/2.6.0/gems/rake-12.3.2/lib/rake/application.rb:703:in `raw_load_rakefile'
/home/git/gitlab/vendor/bundle/ruby/2.6.0/gems/rake-12.3.2/lib/rake/application.rb:104:in `block in load_rakefile'
/home/git/gitlab/vendor/bundle/ruby/2.6.0/gems/rake-12.3.2/lib/rake/application.rb:186:in `standard_exception_handling'
/home/git/gitlab/vendor/bundle/ruby/2.6.0/gems/rake-12.3.2/lib/rake/application.rb:103:in `load_rakefile'
/home/git/gitlab/vendor/bundle/ruby/2.6.0/gems/rake-12.3.2/lib/rake/application.rb:82:in `block in run'
/home/git/gitlab/vendor/bundle/ruby/2.6.0/gems/rake-12.3.2/lib/rake/application.rb:186:in `standard_exception_handling'
/home/git/gitlab/vendor/bundle/ruby/2.6.0/gems/rake-12.3.2/lib/rake/application.rb:80:in `run'
/home/git/gitlab/vendor/bundle/ruby/2.6.0/gems/rake-12.3.2/exe/rake:27:in `<top (required)>'
/home/git/gitlab/vendor/bundle/ruby/2.6.0/bin/rake:23:in `load'
/home/git/gitlab/vendor/bundle/ruby/2.6.0/bin/rake:23:in `<top (required)>'
/usr/local/lib/ruby/gems/2.6.0/gems/bundler-1.17.3/lib/bundler/cli/exec.rb:74:in `load'
/usr/local/lib/ruby/gems/2.6.0/gems/bundler-1.17.3/lib/bundler/cli/exec.rb:74:in `kernel_load'
/usr/local/lib/ruby/gems/2.6.0/gems/bundler-1.17.3/lib/bundler/cli/exec.rb:28:in `run'
/usr/local/lib/ruby/gems/2.6.0/gems/bundler-1.17.3/lib/bundler/cli.rb:463:in `exec'
/usr/local/lib/ruby/gems/2.6.0/gems/bundler-1.17.3/lib/bundler/vendor/thor/lib/thor/command.rb:27:in `run'
/usr/local/lib/ruby/gems/2.6.0/gems/bundler-1.17.3/lib/bundler/vendor/thor/lib/thor/invocation.rb:126:in `invoke_command'
/usr/local/lib/ruby/gems/2.6.0/gems/bundler-1.17.3/lib/bundler/vendor/thor/lib/thor.rb:387:in `dispatch'
/usr/local/lib/ruby/gems/2.6.0/gems/bundler-1.17.3/lib/bundler/cli.rb:27:in `dispatch'
/usr/local/lib/ruby/gems/2.6.0/gems/bundler-1.17.3/lib/bundler/vendor/thor/lib/thor/base.rb:466:in `start'
/usr/local/lib/ruby/gems/2.6.0/gems/bundler-1.17.3/lib/bundler/cli.rb:18:in `start'
/usr/local/lib/ruby/gems/2.6.0/gems/bundler-1.17.3/exe/bundle:30:in `block in <top (required)>'
/usr/local/lib/ruby/gems/2.6.0/gems/bundler-1.17.3/lib/bundler/friendly_errors.rb:124:in `with_friendly_errors'
/usr/local/lib/ruby/gems/2.6.0/gems/bundler-1.17.3/exe/bundle:22:in `<top (required)>'
/usr/local/bin/bundle:23:in `load'
/usr/local/bin/bundle:23:in `<main>'