迁移尚在进行中 [英] Migrations are pending

查看:156
本文介绍了迁移尚在进行中的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试对我的应用程序中的用户进行验证,但是每次我尝试迁移某些内容或进行rake测试时,它总是会出现以下错误:rake中止了! ActiveRecord :: PendingMigrationError:

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

然后,当我运行命令"bin/rake db:migrate RAILS_ENV = test"时,它说权限被拒绝.有人可以帮帮我吗! (我在cloud9中工作,并遵循了当前第6章的Mhartl指南)

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)

推荐答案

您应该可以运行:

bundle exec rake db:migrate

...,它将自动为您的开发环境/数据库运行.不知道为什么要告诉它在测试ENV中运行.如果您可以访问开发数据库并在浏览器中运行您的应用程序,那么您显然具有访问数据库的足够权限.如果您在运行测试时遇到问题,可以执行以下操作:

...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.

这篇关于迁移尚在进行中的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆