0
我有一個引導任務,我打算有db:reset
和db:migrate
作爲先決條件。我定義它是這樣的:爲什麼不將db:migrate作爲先決條件進行調用?
task :bootstrap => [:environment,:"db:reset",:"db:migrate"] do ...
當我運行它,我得到以下的輸出:
** Invoke bs:bootstrap (first_time)
** Invoke environment (first_time)
** Execute environment
** Invoke db:reset (first_time)
** Invoke db:drop (first_time)
** Invoke db:load_config (first_time)
** Invoke rails_env (first_time)
** Execute rails_env
** Execute db:load_config
** Execute db:drop
** Invoke db:setup (first_time)
** Invoke db:create (first_time)
** Invoke db:load_config
** Execute db:create
** Invoke db:schema:load (first_time)
** Invoke environment
** Execute db:schema:load
-- create_table("projects", {:force=>true})
-> 0.0770s
-- create_table("users", {:force=>true})
-> 0.1110s
...
** Invoke db:seed (first_time)
** Invoke db:abort_if_pending_migrations (first_time)
** Invoke environment
** Execute db:abort_if_pending_migrations
You have 1 pending migrations:
20120109172252 CreateObjectives
Run "rake db:migrate" to update your database then try again.
爲什麼不db:migrate
被調用,因爲它的上市爲前提?
是否確定db:reset之前列出的數據不需要遷移掛起,並且在db到達之前失敗:migrate? – 2012-01-09 17:37:49
我應該如何確保數據庫中沒有任何東西?我希望它在啓動之前完全清空。 – Geo 2012-01-09 17:39:04