Project

General

Profile

Actions

Bug #11680

closed

DB:Migrate Multiple migrations have the name AddProvisionMethodToHosts

Added by keith obrien over 8 years ago. Updated over 8 years ago.

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

Description

I ran into this bug migrating from 1.7 to 1.8.3 and from 1.8.3 to 1.9.0.

Running "foreman-rake db:migrate" results in:
ActiveRecord::DuplicateMigrationNameError: Multiple migrations have the name AddProvisionMethodToHosts
/usr/share/foreman/vendor/ruby/1.9.1/gems/activerecord-3.2.21/lib/active_record/migration.rb:637:in `block in migrations'
/usr/share/foreman/vendor/ruby/1.9.1/gems/activerecord-3.2.21/lib/active_record/migration.rb:629:in `map'
....

The Fix:
mv /usr/share/foreman/db/migrate/20140304184854_add_provision_method_to_hosts.rb /usr/share/foreman/db/migrate/20141204184854_add_provision_method_to_hosts.rb

More Details:
https://groups.google.com/forum/#!topic/foreman-users/2nAj8qEu_5o

Host Details:
cat /etc/debian_version
7.8
cat /etc/apt/sources.list.d/foreman.list
#deb http://deb.theforeman.org/ wheezy stable
deb http://deb.theforeman.org/ wheezy 1.9
deb http://deb.theforeman.org/ plugins 1.9

dpkg --list | grep foreman
ii foreman 1.9.0-1 amd64 Systems management web interface
ii foreman-cli 1.9.0-1 all metapackage providing hammer CLI for Foreman
ii foreman-compute 1.9.0-1 all metapackage providing fog dependencies for Foreman,
ii foreman-console 1.9.0-1 all metapackage providing console dependencies for Foreman
ii foreman-ec2 1.9.0-1 all metapackage providing EC2 dependencies for Foreman
ii foreman-installer 1.9.0-1 all Automated puppet-based installer for The Foreman
ii foreman-libvirt 1.9.0-1 all metapackage providing libvirt dependencies for Foreman
ii foreman-mysql 1.3.0-2 all metapackage providing MySQL dependencies for Foreman
ii foreman-postgresql 1.9.0-1 all metapackage providing PostgreSQL dependencies for Foreman
ii foreman-proxy 1.9.0-1 all RESTful proxies for DNS, DHCP, TFTP, and Puppet
ii foreman-sqlite3 1.9.0-1 all metapackage providing sqlite dependencies for Foreman
ii foreman-vmware 1.9.0-1 all metapackage providing vmware dependencies for Foreman
ii ruby-foreman-deface 0.9.1-2 all Foreman Deface Plugin Dependency
ii ruby-foreman-setup 3.0.2 all Foreman Setup Plugin
ii ruby-hammer-cli-foreman 0.3.0-1 all Foreman commands for Hammer

Full Error Output:
foreman-rake db:migrate
rake aborted!
ActiveRecord::DuplicateMigrationNameError: Multiple migrations have the name AddProvisionMethodToHosts
/usr/share/foreman/vendor/ruby/1.9.1/gems/activerecord-3.2.21/lib/active_record/migration.rb:637:in `block in migrations'
/usr/share/foreman/vendor/ruby/1.9.1/gems/activerecord-3.2.21/lib/active_record/migration.rb:629:in `map'
/usr/share/foreman/vendor/ruby/1.9.1/gems/activerecord-3.2.21/lib/active_record/migration.rb:629:in `migrations'
/usr/share/foreman/vendor/ruby/1.9.1/gems/activerecord-3.2.21/lib/active_record/migration.rb:734:in `migrations'
/usr/share/foreman/vendor/ruby/1.9.1/gems/activerecord-3.2.21/lib/active_record/migration.rb:741:in `pending_migrations'
/usr/share/foreman/app/services/foreman/plugin.rb:221:in `pending_migrations'
/usr/share/foreman/app/services/foreman/plugin.rb:199:in `permission'
/usr/share/foreman/vendor/ruby/1.9.1/gems/foreman_setup-3.0.2/lib/foreman_setup/engine.rb:25:in `block (3 levels) in <class:Engine>'
/usr/share/foreman/app/services/foreman/plugin.rb:190:in `instance_eval'
/usr/share/foreman/app/services/foreman/plugin.rb:190:in `security_block'
/usr/share/foreman/vendor/ruby/1.9.1/gems/foreman_setup-3.0.2/lib/foreman_setup/engine.rb:24:in `block (2 levels) in <class:Engine>'
/usr/share/foreman/app/services/foreman/plugin.rb:64:in `instance_eval'
/usr/share/foreman/app/services/foreman/plugin.rb:64:in `register'
/usr/share/foreman/vendor/ruby/1.9.1/gems/foreman_setup-3.0.2/lib/foreman_setup/engine.rb:16:in `block in <class:Engine>'
/usr/share/foreman/vendor/ruby/1.9.1/gems/railties-3.2.21/lib/rails/initializable.rb:30:in `instance_exec'
/usr/share/foreman/vendor/ruby/1.9.1/gems/railties-3.2.21/lib/rails/initializable.rb:30:in `run'
/usr/share/foreman/vendor/ruby/1.9.1/gems/railties-3.2.21/lib/rails/initializable.rb:55:in `block in run_initializers'
/usr/share/foreman/vendor/ruby/1.9.1/gems/railties-3.2.21/lib/rails/initializable.rb:54:in `each'
/usr/share/foreman/vendor/ruby/1.9.1/gems/railties-3.2.21/lib/rails/initializable.rb:54:in `run_initializers'
/usr/share/foreman/vendor/ruby/1.9.1/gems/railties-3.2.21/lib/rails/application.rb:136:in `initialize!'
/usr/share/foreman/vendor/ruby/1.9.1/gems/railties-3.2.21/lib/rails/railtie/configurable.rb:30:in `method_missing'
/usr/share/foreman/config/environment.rb:5:in `<top (required)>'
/usr/share/foreman/vendor/ruby/1.9.1/gems/polyglot-0.3.5/lib/polyglot.rb:65:in `require'
/usr/share/foreman/vendor/ruby/1.9.1/gems/polyglot-0.3.5/lib/polyglot.rb:65:in `require'
/usr/share/foreman/vendor/ruby/1.9.1/gems/activesupport-3.2.21/lib/active_support/dependencies.rb:251:in `block in require'
/usr/share/foreman/vendor/ruby/1.9.1/gems/activesupport-3.2.21/lib/active_support/dependencies.rb:236:in `load_dependency'
/usr/share/foreman/vendor/ruby/1.9.1/gems/activesupport-3.2.21/lib/active_support/dependencies.rb:251:in `require'
/usr/share/foreman/vendor/ruby/1.9.1/gems/railties-3.2.21/lib/rails/application.rb:103:in `require_environment!'
/usr/share/foreman/vendor/ruby/1.9.1/gems/railties-3.2.21/lib/rails/application.rb:305:in `block (2 levels) in initialize_tasks'
Tasks: TOP => db:migrate => environment
(See full trace by running task with --trace)

Actions #1

Updated by Dominic Cleal over 8 years ago

  • Status changed from New to Feedback

It looks like you might already have renamed the file at some previous point? If so then just delete the duplicate file (the 20141204184854 one)? You might also need to add the number to schema_migrations in the DB so it doesn't run again.

Actions #2

Updated by keith obrien over 8 years ago

  • Status changed from Feedback to Closed

Thanks for the feed back and yes I had renamed it prviously do to the problem migrating from the privous version and didn't relaize it was causing the problem in the next migration.

Actions

Also available in: Atom PDF