aboutsummaryrefslogtreecommitdiffstats
path: root/activerecord/lib/active_record/railties
diff options
context:
space:
mode:
authorYves Senn <yves.senn@gmail.com>2014-06-16 19:28:38 +0200
committerYves Senn <yves.senn@gmail.com>2014-06-17 09:20:58 +0200
commite2f232aba15937a4b9d14bd91e0392c6d55be58d (patch)
treea9715a517d1fd59902b104845eddcad534c94be1 /activerecord/lib/active_record/railties
parentb4b5af0342cdb5917d9342cd4da245f19c3b4025 (diff)
downloadrails-e2f232aba15937a4b9d14bd91e0392c6d55be58d.tar.gz
rails-e2f232aba15937a4b9d14bd91e0392c6d55be58d.tar.bz2
rails-e2f232aba15937a4b9d14bd91e0392c6d55be58d.zip
add `bin/rake db:purge` task to empty the current database.
Diffstat (limited to 'activerecord/lib/active_record/railties')
-rw-r--r--activerecord/lib/active_record/railties/databases.rake11
1 files changed, 11 insertions, 0 deletions
diff --git a/activerecord/lib/active_record/railties/databases.rake b/activerecord/lib/active_record/railties/databases.rake
index 6dca206f2a..ecf5afc4f4 100644
--- a/activerecord/lib/active_record/railties/databases.rake
+++ b/activerecord/lib/active_record/railties/databases.rake
@@ -28,6 +28,17 @@ db_namespace = namespace :db do
ActiveRecord::Tasks::DatabaseTasks.drop_current
end
+ namespace :purge do
+ task :all => :load_config do
+ ActiveRecord::Tasks::DatabaseTasks.purge_all
+ end
+ end
+
+ # desc "Empty the database from DATABASE_URL or config/database.yml for the current RAILS_ENV (use db:drop:all to drop all databases in the config). Without RAILS_ENV it defaults to purging the development and test databases."
+ task :purge => [:load_config] do
+ ActiveRecord::Tasks::DatabaseTasks.purge_current
+ end
+
desc "Migrate the database (options: VERSION=x, VERBOSE=false, SCOPE=blog)."
task :migrate => [:environment, :load_config] do
ActiveRecord::Migration.verbose = ENV["VERBOSE"] ? ENV["VERBOSE"] == "true" : true