Data Migration rake aborted

Source: Internet
Author: User

Problem description: rake aborted occurs when the rails project executes rake DB: migrate data migration,

Solution: Check the prompt and run bunlde exec rake DB: migrate. The migration is successful!

Knowledge added: difference in using bundle exec rake DB: migrate (derived from: http://www.iteye.com/problems/73157)

① Bundle provides a sandbox-like mechanism for rails projects, which has many advantages. To put it simply, we can ensure that the project is mainly dependent on the gem version, and rails 3 is changed from gem to core.
What does bundle exec do? Execute bundle-h to see:
"Bundle exec (1) bundle-exec.1.html
Execute a script in the context of the current bundle"
To maintain the working environment, bundle copies the configuration file gemfile to maintain the uniform gem version. Therefore, you can use the same gem for multiple projects, but different versions.

② Is there any difference between bundle Exec: rake DB: migrate is a database transplant. Then, a rake gem is actually called here, so if your system has multiple rake, for example, your system is 0.9, but you write the rake version 0.8.7 in the gemfile of this project. When there are many projects, it is entirely possible that some projects do not have the upgraded gem version. Then, write bundle exec will call rake of 0.8.7 for execution. If you do not write it, the system will call the latest version, that is, rake of 0.9 by default. Therefore, an error may occur.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.