这里的第一篇帖子对任何小说都道歉。 我正在通过关于C9的Lynda.com Ruby on Rails 5 Essential培训工作,并且遇到了一个问题,试图迁移回到' VERSION:0'有这个错误消息:
导轨中止了!
不知道如何建立任务' VERSION:0' (见--tasks)
/usr/local/rvm/gems/ruby-2.3.1/gems/railties-5.1.2/lib/rails/commands/rake/rake_command.rb:21:in block in perform'
/usr/local/rvm/gems/ruby-2.3.1/gems/railties-5.1.2/lib/rails/commands/rake/rake_command.rb:18:in
表演'
/usr/local/rvm/gems/ruby-2.3.1/gems/railties-5.1.2/lib/rails/command.rb:46:in invoke'
/usr/local/rvm/gems/ruby-2.3.1/gems/railties-5.1.2/lib/rails/commands.rb:16:in
'
/ home / ubuntu / workspace / bin / rails:9:require'
/home/ubuntu/workspace/bin/rails:9:in
'
/usr/local/rvm/gems/ruby-2.3.1/gems/spring-2.0.2/lib/spring/client/rails.rb:28:in load'
/usr/local/rvm/gems/ruby-2.3.1/gems/spring-2.0.2/lib/spring/client/rails.rb:28:in
来电'
/usr/local/rvm/gems/ruby-2.3.1/gems/spring-2.0.2/lib/spring/client/command.rb:7:in call'
/usr/local/rvm/gems/ruby-2.3.1/gems/spring-2.0.2/lib/spring/client.rb:30:in
run'
/usr/local/rvm/gems/ruby-2.3.1/gems/spring-2.0.2/bin/spring:49:in <top (required)>'
/usr/local/rvm/gems/ruby-2.3.1/gems/spring-2.0.2/lib/spring/binstub.rb:31:in
load&#39;
/usr/local/rvm/gems/ruby-2.3.1/gems/spring-2.0.2/lib/spring/binstub.rb:31:in <top (required)>'
/home/ubuntu/workspace/bin/spring:15:in
要求&#39;
/ home / ubuntu / workspace / bin / spring:15:<top (required)>'
bin/rails:3:in
加载&#39;
bin / rails:3:在`&#39;
非常感谢任何帮助或建议
答案 0 :(得分:0)
在Rails中进行迁移时,您可以执行以下操作:
rake db:migrate
,它会将您的新迁移迁移到database
并将其添加到scheme.rb
。
您还可以执行rake db:rollback
,回滚 上次迁移。
对于回滚,您还可以执行rake db:rollback STEP=n
,这将回滚n
次迁移,其中n
是您要回滚的最近迁移次数。
如果您要回滚版本的迁移,则应将迁移版本应用为:rake db:migrate VERSION=0
(如@sjudge在评论中所述)
您也可以rake db:migrate:redo
。
还有其他一些迁移,例如:
rake db:migrate:redo STEP=n
rake db:migrate:up VERSION=20080906120000
rake db:migrate:down VERSION=20080906120000