Labanino
Labanino

Reputation: 3960

rake db:migrate not creating table

I'm just following this RoR tut, I'm doing it the same way but I'm stuck creating a table:

$ rails generate model User
      invoke  active_record
      create    db/migrate/20140718180319_create_users.rb
      create    app/models/user.rb
      invoke    test_unit
      create      test/models/user_test.rb
      create      test/fixtures/users.yml

This is my xxxxx_create_users.rb

class CreateUsers < ActiveRecord::Migration

  def Up
    create_table :users do |t|
      t.column "first_name", :string, :limit => 25
      t.string "last_name", :limit => 50
      t.string "email", :default => "", :null => false
      t.string "password", :limit => 40
      t.timestamps
    end
  end

  def down
    drop_table :users
  end

end

When I run db:migrate the table is not being created:

$ rake db:migrate
== 20140718182504 CreateUsers: migrating ======================================
== 20140718182504 CreateUsers: migrated (0.0000s) =============================

Is missing

create_table(:users)
-> x.xxxxxs

What am I doing wrong? Thanks.

Upvotes: 1

Views: 306

Answers (1)

Fran&#231;ois Bruneau
Fran&#231;ois Bruneau

Reputation: 169

Isn't it a typo with your "Up" migration method? Try with:

def up

instead of:

def Up

Upvotes: 3

Related Questions