rails generate migration table name命令不会在db / migrate中创建迁移

时间:2018-06-01 20:55:35

标签: ruby-on-rails database-migration rails-migrations

我正在跑步 $ rails generate migration Tablename 命令提示符中的命令。我应该在db / migrate中看到新创建的表吗?我是铁杆新手。

我可以看到以下错误:

rails generate migration TruncateUnusedTables
.rbenv/versions/2.1.2/lib/ruby/gems/2.1.0/gems/spring-1.5.0/lib/spring/client/run.rb:98:in `gets': Interrupt
.rbenv/versions/2.1.2/lib/ruby/gems/2.1.0/gems/spring-1.5.0/lib/spring/client/run.rb:98:in `verify_server_version'
.rbenv/versions/2.1.2/lib/ruby/gems/2.1.0/gems/spring-1.5.0/lib/spring/client/run.rb:56:in `run'
.rbenv/versions/2.1.2/lib/ruby/gems/2.1.0/gems/spring-1.5.0/lib/spring/client/run.rb:37:in `warm_run'
.rbenv/versions/2.1.2/lib/ruby/gems/2.1.0/gems/spring-1.5.0/lib/spring/client/run.rb:26:in `call'
.rbenv/versions/2.1.2/lib/ruby/gems/2.1.0/gems/spring-1.5.0/lib/spring/client/command.rb:7:in `call'
.rbenv/versions/2.1.2/lib/ruby/gems/2.1.0/gems/spring-1.5.0/lib/spring/client/rails.rb:24:in `call'
.rbenv/versions/2.1.2/lib/ruby/gems/2.1.0/gems/spring-1.5.0/lib/spring/client/command.rb:7:in `call'
.rbenv/versions/2.1.2/lib/ruby/gems/2.1.0/gems/spring-1.5.0/lib/spring/client.rb:28:in `run'
.rbenv/versions/2.1.2/lib/ruby/gems/2.1.0/gems/spring-1.5.0/bin/spring:49:in `<top (required)>'
.rbenv/versions/2.1.2/lib/ruby/gems/2.1.0/gems/spring-1.5.0/lib/spring/binstub.rb:11:in `load'
.rbenv/versions/2.1.2/lib/ruby/gems/2.1.0/gems/spring-1.5.0/lib/spring/binstub.rb:11:in `<top (required)>'
    from .rbenv/versions/2.1.2/lib/ruby/2.1.0/rubygems/core_ext/kernel_require.rb:55:in `require'
    from .rbenv/versions/2.1.2/lib/ruby/2.1.0/rubygems/core_ext/kernel_require.rb:55:in `require'
    from /bin/spring:13:in `<top (required)>'
    from bin/rails:3:in `load'
    from bin/rails:3:in `<main>'

1 个答案:

答案 0 :(得分:0)

  

我是铁杆新手。

欢迎!我们来帮忙。

  

我应该在db / migrate中看到新创建的表吗?

不在$ rails generate migration Tablename。您需要配置迁移,以便创建表。这是一个很大的主题,因此请转到guides阅读有关生成迁移的信息。