DG IZ; db rake tasks ouput text; delete is now purge
This commit is contained in:
parent
df6ea31d3d
commit
585906d3d4
1 changed files with 11 additions and 2 deletions
|
|
@ -1,12 +1,18 @@
|
|||
namespace :db do
|
||||
desc 'Seed the current RAILS_ENV database from db/seeds.rb'
|
||||
task :seed do
|
||||
|
||||
puts "Seeding the database for #{RAILS_ENV}..."
|
||||
|
||||
require 'db/seeds'
|
||||
end
|
||||
|
||||
desc 'Delete the collections in the current RAILS_ENV database'
|
||||
task :delete do
|
||||
task :purge do
|
||||
require 'config/environment'
|
||||
|
||||
puts "Purging the database for #{RAILS_ENV}..."
|
||||
|
||||
# Specifiy what models to remove
|
||||
Post.delete_all
|
||||
Person.delete_all
|
||||
|
|
@ -15,7 +21,10 @@ namespace :db do
|
|||
|
||||
desc 'Purge and seed the current RAILS_ENV database using information from db/seeds.rb'
|
||||
task :reset do
|
||||
Rake::Task['db:delete'].invoke
|
||||
|
||||
puts "Resetting the database for #{RAILS_ENV}".upcase
|
||||
Rake::Task['db:purge'].invoke
|
||||
Rake::Task['db:seed'].invoke
|
||||
puts "Success!"
|
||||
end
|
||||
end
|
||||
|
|
|
|||
Loading…
Reference in a new issue