我是rake新手,我正在尝试找到自动化某些任务的方法。所以我写了我的第一个rake 任务并且失败了:
namespace :app do
desc "Leaves application like new"
task :reset => :environment do
Rake::Task['db:drop:all'].invoke
Rake::Task['db:create:all'].invoke
Rake::Task['db:migrate'].invoke
Rake::Task['db:seed'].invoke
end
end
我想知道为什么这不起作用。调用后:
rake app:reset
一切运行良好,我可以在屏幕上看到迁移消息,如下所示:
== CreateGalerias: migrating =================================================
-- create_table(:galerias)
NOTICE: CREATE TABLE will create implicit sequence "galerias_id_seq" for serial column "galerias.id"
NOTICE: CREATE TABLE / PRIMARY KEY will create implicit index "galerias_pkey" for table "galerias"
-> 0.1191s
== CreateGalerias: migrated (0.1194s) ========================================
但是,最后我收到这条消息:
You have 11 pending migrations:
20110704052637 CreatePersonas
20110709100632 CreateOrganizaciones
20110709100646 CreateEventos
20110816102451 CreateMembresias
20110816155851 CreateCelebraciones
20110822135820 ActsAsTaggableOnMigration
20120410063100 CreateDocumentos
20120507200516 CreateUsuarios
20120515214226 ActivaUnnaccent
20120516091228 CreateGalerias
20120517004708 SetupHstore
Run `rake db:migrate` to update your database then try again.
不是刚迁移数据库吗?为什么抱怨它?