2012-01-14 375 views
0

我在使用mysql遷移數據庫時遇到了問題,並決定將整個事情從水中移出並使用postgres。我已經將它與數據庫一起正確安裝,但現在我得到了與我使用mysql時相同的錯誤。rake在rake數據庫後遷移db:migrate

$ rake db:migrate 
rake aborted! 
/Users/beach180/rails_projects/app/db/migrate/20120114221528_create_users.rb:6: syntax   error, unexpected ':', expecting keyword_end 
    t.string "email" :default => "", :null => false 

這是RB文件

class CreateUsers < ActiveRecord::Migration 
    def up 
    create_table :users do |t| 
     t.string "first_name", :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 

有什麼想法?

回答

2

您在字符串「email」後缺少逗號。

t.string "email", :default => "", :null => false 
       ^comma 
+0

是的,就是這樣。要爲另一個錯誤創建另一張票。 Thx Dave :) – beach180 2012-01-14 22:40:26

相關問題