У меня есть задача начальной загрузки, которую я намерен использовать в качестве предварительных условий db:reset
и 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
, поскольку он указан как предварительное условие?