Combining many rake tasks into one rake task

前端 未结 3 815
小蘑菇
小蘑菇 2021-02-02 10:16

Instead of running each rake task individually like this:

rake db:drop
rake db:create
rake db:migrate
rake db:load

I want to run one rake task

3条回答
  •  孤城傲影
    2021-02-02 10:50

    namespace :rebuild_dev do
     desc 'This rebuilds development db'
      task :clean_slate => :environment do 
        Rake::Task["db:drop"].invoke
        Rake::Task["db:create"].invoke
        Rake::Task["db:migrate"].invoke
        Rake::Task["db:load"].invoke
      end
    end
    

提交回复
热议问题