Search code examples
ruby-on-railsdatabase-migrationrails-migrations

rails generate migration table name command does not create migration in db/migrate


I am running $ rails generate migration Tablename command in command prompt. Should I see the newly created table in db/migrate? I am new in rails.

I can see the following error:

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

Solution

  • I am new in rails.

    Welcome! We're here to help.

    Should I see the newly created table in db/migrate?

    Not with $ rails generate migration Tablename. You will need to configure your migration such that the table is created. This is a big topic, so head over to the guides to read up on generating migrations.