added rake task to clear and re-seed the database on schedule

This commit is contained in:
Mike Kelley
2011-12-28 15:38:08 -07:00
parent ffcb2bb0b9
commit 61c9ddf2c3
3 changed files with 19 additions and 2 deletions

View File

@@ -33,7 +33,7 @@ ActiveRecord::Schema.define(:version => 20110808221332) do
end
create_table "posts", :force => true do |t|
t.string "body"
t.text "body"
t.integer "forum_id"
t.integer "topic_id"
t.integer "user_id"

17
lib/tasks/reset.rake Normal file
View File

@@ -0,0 +1,17 @@
namespace :community do
desc "clears the database"
task :reset do
if Rails.env == "production"
Rake::Task['pg:reset'].invoke
else
Rake::Task['db:migrate:reset'].invoke
end
end
desc "re-seed the database"
task :seed => :reset do
Rake::Task['db:seed'].invoke
end
end