Posted By

ctran on 08/20/06


rails migration

Versions (?)

Who likes this?

2 people have marked this snippet as a favorite



 / Published in: Ruby

Drop all tables in the current database. This is useful during development where you keep changing the same migration files (logical grouping).

  1. namespace :db
  2. desc "Dropping all tables"
  3. task :drop_all => :environment do
  4. result = ActiveRecord::Migration::execute 'show tables'
  5. result.each { |table| ActiveRecord::Migration::drop_table table }
  6. end
  7. end

Report this snippet  

You need to login to post a comment.