Rails Locally Installing Rails Application rake db:migrate returns
I have a private Rails 开发者_高级运维app that I'm trying to install locally. It's currently running in a hosting environment but I'd like to install it locally to begin making changes. I've already worked out that I can make deploy updates to the 'live' server but a recent misstep 'reinforced the need to make changes locally'.
After a fair amount of reading I determined that I needed to...
- Grab the latest repository (It uses SVN)
- Grab the database mysqldump -u root --databases my_db_development > my_db_development_0110.sql
- Imported database locally (MAMP/Sequel Pro noticed there was no data in the database although there is data in the live server - is that strange?)
- Validate database.yml (adapter: mysql, encoding: utf8, database: my_db_development, username: root, password: , host: localhost)
The next step I assumed was to get into my local directory and rake db:migrate --trace which returned the output below.
I'm a bit unsure how to go about understanding and identifying why I'm unable to move forward. Any ideas as to whether I've missed something or perhaps need to change something?
(in /Users/me/my_repo)
** Invoke db:migrate (first_time)
** Invoke environment (first_time)
** Execute environment
** Execute db:migrate
rake aborted!
Multiple migrations have the version number 1
/Users/me/.gem/ruby/1.8/gems/activerecord-2.1.2/lib/active_record/migration.rb:472:in `migrations'
/Users/me/.gem/ruby/1.8/gems/activerecord-2.1.2/lib/active_record/connection_adapters/mysql_adapter.rb:15:in `inject'
/Users/me/.gem/ruby/1.8/gems/activerecord-2.1.2/lib/active_record/migration.rb:465:in `each'
/Users/me/.gem/ruby/1.8/gems/activerecord-2.1.2/lib/active_record/migration.rb:465:in `inject'
/Users/me/.gem/ruby/1.8/gems/activerecord-2.1.2/lib/active_record/migration.rb:465:in `migrations'
/Users/me/.gem/ruby/1.8/gems/activerecord-2.1.2/lib/active_record/migration.rb:431:in `migrate'
/Users/me/.gem/ruby/1.8/gems/activerecord-2.1.2/lib/active_record/migration.rb:373:in `up'
/Users/me/.gem/ruby/1.8/gems/activerecord-2.1.2/lib/active_record/migration.rb:356:in `migrate'
/Users/me/.gem/ruby/1.8/gems/rails-2.1.2/lib/tasks/databases.rake:99
/Library/Ruby/Gems/1.8/gems/rake-0.8.7/lib/rake.rb:636:in `call'
/Library/Ruby/Gems/1.8/gems/rake-0.8.7/lib/rake.rb:636:in `execute'
/Library/Ruby/Gems/1.8/gems/rake-0.8.7/lib/rake.rb:631:in `each'
/Library/Ruby/Gems/1.8/gems/rake-0.8.7/lib/rake.rb:631:in `execute'
/Library/Ruby/Gems/1.8/gems/rake-0.8.7/lib/rake.rb:597:in `invoke_with_call_chain'
/System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/1.8/monitor.rb:242:in `synchronize'
/Library/Ruby/Gems/1.8/gems/rake-0.8.7/lib/rake.rb:590:in `invoke_with_call_chain'
/Library/Ruby/Gems/1.8/gems/rake-0.8.7/lib/rake.rb:583:in `invoke'
/Library/Ruby/Gems/1.8/gems/rake-0.8.7/lib/rake.rb:2051:in `invoke_task'
/Library/Ruby/Gems/1.8/gems/rake-0.8.7/lib/rake.rb:2029:in `top_level'
/Library/Ruby/Gems/1.8/gems/rake-0.8.7/lib/rake.rb:2029:in `each'
/Library/Ruby/Gems/1.8/gems/rake-0.8.7/lib/rake.rb:2029:in `top_level'
/Library/Ruby/Gems/1.8/gems/rake-0.8.7/lib/rake.rb:2068:in `standard_exception_handling'
/Library/Ruby/Gems/1.8/gems/rake-0.8.7/lib/rake.rb:2023:in `top_level'
/Library/Ruby/Gems/1.8/gems/rake-0.8.7/lib/rake.rb:2001:in `run'
/Library/Ruby/Gems/1.8/gems/rake-0.8.7/lib/rake.rb:2068:in `standard_exception_handling'
/Library/Ruby/Gems/1.8/gems/rake-0.8.7/lib/rake.rb:1998:in `run'
/Library/Ruby/Gems/1.8/gems/rake-0.8.7/bin/rake:31
/usr/bin/rake:19:in `load'
/usr/bin/rake:19
It seems you have duplicate migrations in your migrate directory. Check the prefixes of the migrations under database_migrations/migrate and make sure you haven't copied multiple versions or created migrations out of sync with the repository.
If you are importing the entire database from your production environment, then you won't need to run db:migrate - the database/schema should already be up to date. It sounds like you are missing data in your local database and something went wrong with the import.
精彩评论