提交 c47525a5 编写于 作者: P Philip Hallstrom 提交者: Michael Koziarski

make db:migrate:redo rake task accept an optional VERSION to target that specific migration to redo

Signed-off-by: NMichael Koziarski <michael@koziarski.com>
上级 4db7e8de
......@@ -113,8 +113,16 @@ namespace :db do
end
namespace :migrate do
desc 'Rollbacks the database one migration and re migrate up. If you want to rollback more than one step, define STEP=x'
task :redo => [ 'db:rollback', 'db:migrate' ]
desc 'Rollbacks the database one migration and re migrate up. If you want to rollback more than one step, define STEP=x. Target specific version with VERSION=x.'
task :redo => :environment do
if ENV["VERSION"]
Rake::Task["db:migrate:down"].invoke
Rake::Task["db:migrate:up"].invoke
else
Rake::Task["db:rollback"].invoke
Rake::Task["db:migrate"].invoke
end
end
desc 'Resets your database using your migrations for the current environment'
task :reset => ["db:drop", "db:create", "db:migrate"]
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册