简体   繁体   English

heroku rake db:迁移不起作用

[英]heroku rake db:migrate didn't work

I've run a migration adding active column to users using heroku rake db:migrate.我已经运行迁移,使用 heroku rake db:migrate 向用户添加活动列。 and succesfully.并成功。 but when I run the application the "active" column/attributes is not defined.但是当我运行应用程序时,未定义“活动”列/属性。

I already try to migrate:down and run migrate again for that version.. but it's still not worked.我已经尝试 migrate:down 并为该版本再次运行 migrate .. 但它仍然没有工作。

did you add :active to the list of accessible attributes?您是否将:active添加到可访问属性列表中?

attr_accessible :active    

failing that, sometimes you need to run heroku rake db:restart失败了,有时你需要运行heroku rake db:restart

and just finally, if it's still not working, run heroku logs and you will probably find something最后,如果仍然无法正常工作,请运行heroku logs ,您可能会发现一些东西

Try this, it will run both the up and the down which will help you better analyze the situation.试试这个,它会向上和向下运行,这将帮助您更好地分析情况。 Also, there may be a problem in your migrations, if you post the code I should be able to asset further.此外,您的迁移可能存在问题,如果您发布代码,我应该能够进一步资产。

rake db:migrate:redo

Try to restart you application or drop database, if it doesnt contain valuable information.如果它不包含有价值的信息,请尝试重新启动您的应用程序或删除数据库。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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