[英]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: 我只是遵循这个RoR tut,我正在以同样的方式这样做,但我不得不创建一个表:
$ 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 这是我的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: 当我运行db:migrate时,表没有被创建:
$ rake db:migrate
== 20140718182504 CreateUsers: migrating ======================================
== 20140718182504 CreateUsers: migrated (0.0000s) =============================
Is missing 不见了
create_table(:users)
-> x.xxxxxs
What am I doing wrong? 我究竟做错了什么? Thanks.
谢谢。
Isn't it a typo with your "Up" migration method? 这不是你的“Up”迁移方法的错字吗? Try with:
试试:
def up
instead of: 代替:
def Up
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.