简体   繁体   中英

Rails , rake db:migrate giving error on cloning app from github

I have fetched 2 my apps(which have been working in other linux enviornments) from github in newly installed linux. I installed , mysql, nodejs also. I created a test application in rails , and have tested it to be working. But the apps i have cloned, are giving error on running rake db:migrate.

The error in app1 :

rake db:migrate == CreateItems: migrating ==================================================== -- create_table(:items) -> 0.0025s == CreateItems: migrated (0.0027s) ===========================================

== AddDataToTableItems: migrating ============================================ rake aborted! An error has occurred, this and all later migrations canceled:

undefined method `manufacturer' for #

The error in app2

rake db:migrate rake aborted! undefined method `[]=' for nil:NilClass

(See full trace by running task with --trace)

Though both the errors are different, they should be related(as the apps are working in other enviornments) . I am stuck due to the issue for half a day . Any inputs regarding the same ?

PS:Migration files for the apps are as follows : http://dl.dropbox.com/u/18367173/migrate_app2.tar.gz http://dl.dropbox.com/u/18367173/migrate_app1.tar.gz

I believe you're trying to add something in a manufacturer field before creating that table column.

Ensure that first all the real migrations are run (those modifying the schema) and only after, run the ones where you publish data in your db.

By the way, you shouldn't use migrations to publish sample data in your apps, you should use rake tasks for this or database seeds.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM