Migrations are pending

隐身守侯 提交于 2019-12-21 21:32:54

问题


I'm trying to make validations for the users in my app but every time i try to migrate something or run a rake test it constantly gives me this error: rake aborted! ActiveRecord::PendingMigrationError:

Migrations are pending. To resolve this issue, run:

    bin/rake db:migrate RAILS_ENV=test

then when I run the command " bin/rake db:migrate RAILS_ENV=test" it says permission denied. Can someone please help me! ( Im working in cloud9 and following the Mhartl guide currently on chapter 6)


回答1:


You should be able to run:

bundle exec rake db:migrate

...and it will automatically run for your dev environment/database. Not sure why you're telling it to run in the test ENV. If you can access your dev database and run your app in your browser you clearly have enough permissions to access the database. If your issue comes when running tests you can do:

bundle exec rake db:test:prepare

That will get your test schema where it needs to be.



来源:https://stackoverflow.com/questions/31658151/migrations-are-pending

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!