2012-01-11 17 views
11

我試圖運行db:migrate。 但是,因爲其中一個遷移試圖更新的表不存在。我搜索了代碼庫,這個表是在db/schema.rb中創建的。如何運行schema.rb?

如何在db:migrate之前運行schema.rb?

回答

30

使用模式負載任務:

rake db:schema:load 

rake -T(刪減版):

rake db:schema:dump # Create db/schema.rb file usable with any AR-supported DB 
rake db:schema:load # Load schema.rb file into DB